use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.
the class RoleCacheWrapper method initCache.
@Override
public void initCache(IRoleDAO roleDAO) throws ApsSystemException {
try {
Cache cache = this.getCache();
this.releaseCachedObjects(cache);
Map<String, Role> roles = roleDAO.loadRoles();
this.insertObjectsOnCache(cache, roles);
} catch (Throwable t) {
_logger.error("Error loading roles", t);
throw new ApsSystemException("Error loading roles", t);
}
}
use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.
the class RoleAction method delete.
public String delete() {
try {
String result = this.checkRoleForDelete();
if (null != result)
return result;
IRoleManager roleManager = this.getRoleManager();
Role role = roleManager.getRole(this.getName());
roleManager.removeRole(role);
} catch (Throwable t) {
_logger.error("error in delete", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.
the class RoleAction method showDetail.
public String showDetail() {
this.setStrutsAction(ApsAdminSystemConstants.EDIT);
try {
if (!this.existsRole()) {
this.addActionError(this.getText("error.role.notExist"));
return "roleList";
}
Role role = this.getRoleManager().getRole(this.getName());
this.setDescription(role.getDescription());
this.setPermissionNames(role.getPermissions());
this.isRoleInUse();
} catch (Throwable t) {
_logger.error("error in view", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.
the class UserControllerIntegrationTest method createRole.
private Role createRole(int i) {
Role role = new Role();
role.setDescription("descr" + i);
role.setName("role" + i);
return role;
}
use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.
the class OAuth2TestUtils method addAuthorization.
public static void addAuthorization(User user, String groupName, String roleName, String[] permissions) {
Group group = null;
if (StringUtils.isNotBlank(groupName)) {
group = new Group();
group.setName(groupName);
group.setDescription(groupName + " descr");
}
Role role = null;
if (StringUtils.isNotBlank(roleName)) {
role = new Role();
role.setName(roleName);
role.setDescription(roleName + " descr");
if (null != permissions) {
for (String permissionName : permissions) {
role.addPermission(permissionName);
}
}
}
Authorization auth = new Authorization(group, role);
user.addAuthorization(auth);
}
Aggregations