use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.
the class AuthorizationManager method addUserAuthorization.
@Override
public void addUserAuthorization(String username, String groupName, String roleName) throws ApsSystemException {
try {
Group group = (null != groupName) ? this.getGroupManager().getGroup(groupName) : null;
if (null != groupName && null == group) {
_logger.warn("invalid authorization - invalid referenced group name");
return;
}
Role role = (null != roleName) ? this.getRoleManager().getRole(roleName) : null;
if (null != roleName && null == role) {
_logger.warn("invalid authorization - invalid referenced role name");
return;
}
Authorization authorization = new Authorization(group, role);
this.addUserAuthorization(username, authorization);
} catch (Throwable t) {
_logger.error("Error adding user authorization for user '{}'", username, t);
throw new ApsSystemException("Error adding user authorization for user " + username, t);
}
}
use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.
the class AuthorizationManager method getUserAuthorizations.
@Override
public List<Authorization> getUserAuthorizations(String username) throws ApsSystemException {
List<Authorization> authorizations = null;
try {
Map<String, Group> groups = (Map<String, Group>) this.getAuthorityMap(this.getGroupManager().getGroups());
Map<String, Role> roles = (Map<String, Role>) this.getAuthorityMap(this.getRoleManager().getRoles());
authorizations = this.getAuthorizationDAO().getUserAuthorizations(username, groups, roles);
} catch (Throwable t) {
_logger.error("Error extracting user authorizations for user '{}'", username, t);
throw new ApsSystemException("Error extracting user authorizations for user " + username, t);
}
return authorizations;
}
use of com.agiletec.aps.system.services.group.Group in project entando-core by entando.
the class GroupManagerCacheWrapper method initCache.
@Override
public void initCache(IGroupDAO groupDAO) throws ApsSystemException {
try {
Cache cache = this.getCache();
this.releaseCachedObjects(cache);
Map<String, Group> groups = groupDAO.loadGroups();
this.insertObjectsOnCache(cache, groups);
} catch (Throwable t) {
_logger.error("Error loading groups", t);
throw new ApsSystemException("Error loading groups", t);
}
}
Aggregations