use of org.xdi.model.GluuUserRole in project oxTrust by GluuFederation.
the class SecurityService method isUseAdminUser.
public boolean isUseAdminUser(String userName) {
try {
User user = personService.getUserByUid(userName);
GluuUserRole[] roles = getUserRoles(user);
for (GluuUserRole role : roles) {
if (GluuUserRole.MANAGER.equals(role)) {
return true;
}
}
} catch (Exception ex) {
log.error("Failed to find user '{}' in ldap", userName, ex);
}
return false;
}
use of org.xdi.model.GluuUserRole in project oxTrust by GluuFederation.
the class OxChooserWebService method postLogin.
public void postLogin(GluuCustomPerson person) throws Exception {
log.debug("Configuring application after user '{}' login", person.getUid());
identity.setUser(person);
// Set user roles
GluuUserRole[] userRoles = securityService.getUserRoles(person);
for (GluuUserRole userRole : userRoles) {
identity.addRole(userRole.getRoleName());
}
}
use of org.xdi.model.GluuUserRole in project oxTrust by GluuFederation.
the class SecurityService method getUserRoles.
/**
* Get person user roles
*
* @param user
* Person
* @return List of roles
* @throws Exception
* exception
*/
public GluuUserRole[] getUserRoles(User user) {
GluuOrganization organization = organizationService.getOrganization();
// String ownerGroupDn = organization.getOwnerGroup();
String managerGroupDn = organization.getManagerGroup();
String personDN = user.getDn();
Set<GluuUserRole> userRoles = new HashSet<GluuUserRole>();
if (groupService.isMemberOrOwner(managerGroupDn, personDN)) {
userRoles.add(GluuUserRole.MANAGER);
}
if ((userRoles.size() == 0)) /*
* &&
* (GluuStatus.ACTIVE.equals(person.getStatus
* ()))
*/
{
userRoles.add(GluuUserRole.USER);
}
return userRoles.toArray(new GluuUserRole[userRoles.size()]);
}
Aggregations