use of com.blackducksoftware.integration.hub.api.generated.view.RoleAssignmentView in project hub-alert by blackducksoftware.
the class LoginActions method isUserRoleValid.
public boolean isUserRoleValid(final String userName, final RestConnection restConnection) {
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
final UserGroupService userGroupService = hubServicesFactory.createUserGroupService();
try {
final List<RoleAssignmentView> userRoles = userGroupService.getRolesForUser(userName);
for (final RoleAssignmentView roles : userRoles) {
if ("System Administrator".equalsIgnoreCase(roles.name)) {
return true;
}
}
} catch (final IntegrationException e) {
return false;
}
return false;
}
Aggregations