perAPI.setDefaultCMSAdminPermissions(structure);
User systemUser = APILocator.getUserAPI().getSystemUser();
/*Permission for cmsanonymous*/
Permission p = new Permission(structure.getPermissionId(), APILocator.getRoleAPI().loadCMSAnonymousRole().getId(), PermissionAPI.PERMISSION_READ + PermissionAPI.PERMISSION_EDIT + PermissionAPI.PERMISSION_PUBLISH, true);
try{
perAPI.save(p, structure, systemUser, false);
}catch(Exception e){
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
}
/*Permission for form editor*/
p = new Permission();
p.setRoleId(APILocator.getRoleAPI().loadRoleByKey("Form Editor").getId());
p.setPermission(PermissionAPI.PERMISSION_READ);
p.setInode(structure.getPermissionId());
try {
perAPI.save(p, structure, systemUser, false);
} catch (DataAccessException e) {
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
} catch (DotSecurityException e) {
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
}
p = new Permission();
p.setRoleId(APILocator.getRoleAPI().loadRoleByKey("Form Editor").getId());
p.setPermission(PermissionAPI.PERMISSION_WRITE);
p.setInode(structure.getPermissionId());
try {
perAPI.save(p, structure, systemUser, false);
} catch (DataAccessException e) {
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
} catch (DotSecurityException e) {
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
}
p = new Permission();
p.setRoleId(APILocator.getRoleAPI().loadRoleByKey("Form Editor").getId());
p.setPermission(PermissionAPI.PERMISSION_PUBLISH);
p.setInode(structure.getPermissionId());
try {
perAPI.save(p, structure, systemUser, false);
} catch (DataAccessException e) {
Logger.debug(FormAPIImpl.class, "Permission with Inode" + p + " cannot be saved over this asset: " + structure);
} catch (DotSecurityException e) {