private boolean isAccountLockByPassForUser(UserStoreManager userStoreManager, String userName) throws AccountLockException { try { String[] roleList = userStoreManager.getRoleListOfUser(userName); if (!ArrayUtils.isEmpty(roleList)) { return ArrayUtils.contains(roleList, AccountConstants.ACCOUNT_LOCK_BYPASS_ROLE); } } catch (UserStoreException e) { throw new AccountLockException("Error occurred while listing user role: " + userName, e); } return false; } }
public String[] getRoleListOfUser(String userName) throws UserStoreException { return getUserStoreManager().getRoleListOfUser(userName); }
/** * Check whether the account is attached with account lock bypassable role. * * @param userName user name whos roles needs to be listed * @return true or false based on user roles * @throws CarbonException, UserStoreException */ public static boolean isAccountLockable(String userName) throws CarbonException, UserStoreException { boolean isLockable = true; String[] roleList = AdminServicesUtil.getUserRealm().getUserStoreManager().getRoleListOfUser(userName); if (roleList != null) { for (String roleName : roleList) { if (roleName.equals(bypassRoleName)) { isLockable = false; break; } } } return isLockable; } }
String[] roles = carbonUM.getRoleListOfUser(userName); currentRoleList = Arrays.asList(roles); fullRoleList.addAll(currentRoleList);
getUserRealm().getUserStoreManager().getRoleListOfUser(((UserRegistry) this.registry).getUserName()); TierPermissionDTO tierPermission = appMDAO.getTierPermission(tierName, tenantId); if (tierPermission == null) {
getUserRealm().getUserStoreManager().getRoleListOfUser(((UserRegistry) this.registry).getUserName());
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
ServiceGroupFilePersistenceManager serviceGroupFilePM) throws UserStoreException { try { String[] rolesList = realm.getUserStoreManager().getRoleListOfUser(tenantAwareUserName);
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
ServiceGroupFilePersistenceManager serviceGroupFilePM) throws UserStoreException { try { String[] rolesList = realm.getUserStoreManager().getRoleListOfUser(tenantAwareUserName);
ServiceGroupFilePersistenceManager serviceGroupFilePM) throws UserStoreException { try { String[] rolesList = realm.getUserStoreManager().getRoleListOfUser(tenantAwareUserName);
@Override public boolean hasRole(JsAuthenticatedUser user, String roleName) { boolean result = false; String tenantDomain = user.getWrapped().getTenantDomain(); String userStoreDomain = user.getWrapped().getUserStoreDomain(); String username = user.getWrapped().getUserName(); try { UserRealm userRealm = getUserRealm(user.getWrapped().getTenantDomain()); if (userRealm != null) { UserStoreManager userStore = getUserStoreManager(tenantDomain, userRealm, userStoreDomain); if (userStore != null) { result = Arrays.stream(userStore.getRoleListOfUser(username)).anyMatch(r -> r.equals(roleName)); } } } catch (FrameworkException e) { LOG.error("Error in evaluating the function ", e); } catch (UserStoreException e) { LOG.error("Error in getting user from store at the function ", e); } return result; }
String[] roles = carbonUM.getRoleListOfUser(userName);
List<PermissionsBean> permissionsBeans = transitionPermission.get(currentState); String[] roles = CurrentSession.getUserRealm().getUserStoreManager().getRoleListOfUser(user);
@Override public boolean hasAnyOfTheRoles(JsAuthenticatedUser user, List<String> roleNames) { boolean result = false; String tenantDomain = user.getWrapped().getTenantDomain(); String userStoreDomain = user.getWrapped().getUserStoreDomain(); String username = user.getWrapped().getUserName(); try { UserRealm userRealm = getUserRealm(user.getWrapped().getTenantDomain()); if (userRealm != null) { UserStoreManager userStore = getUserStoreManager(tenantDomain, userRealm, userStoreDomain); if (userStore != null) { String[] roleListOfUser = userStore.getRoleListOfUser(username); result = Arrays.stream(roleListOfUser).anyMatch(roleNames::contains); } } } catch (FrameworkException e) { LOG.error("Error in evaluating the function ", e); } catch (UserStoreException e) { LOG.error("Error in getting user from store at the function ", e); } return result; }
.getRoleListOfUser(username));
@Override public LCStateBean getLifeCycleStateBean(String artifactId, String artifactLC) throws LifeCycleException { try { UserRegistry registry = (UserRegistry) getGovernanceUserRegistry(); UserRealm userRealm = registry.getUserRealm(); String[] roleNames = userRealm.getUserStoreManager().getRoleListOfUser(registry.getUserName()); String path = GovernanceUtils.getArtifactPath(registry, artifactId); if (path != null) { removeCache(registry, path); Resource resource = registry.get(path); LCStateBean lifeCycleStateBean = getCheckListItems(resource, artifactLC, roleNames, registry); GovernanceArtifact governanceArtifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, artifactId); Map<String, String> currentStateDurationData = governanceArtifact .getCurrentStateDuration(artifactId, artifactLC); if (currentStateDurationData != null && !currentStateDurationData.isEmpty()) { lifeCycleStateBean .setLifeCycleCurrentStateDuration(currentStateDurationData.get("currentStateDuration")); lifeCycleStateBean .setLifeCycleCurrentStateDurationColour(currentStateDurationData.get("durationColour")); } return lifeCycleStateBean; } else { throw new LifeCycleException("Unable to find the artifact " + artifactId); } } catch (UserStoreException | RegistryException e) { throw new LifeCycleException(e); } }
UserRegistry registry = (UserRegistry) getGovernanceUserRegistry(); UserRealm userRealm = registry.getUserRealm(); String[] rolesList = userRealm.getUserStoreManager().getRoleListOfUser(registry.getUserName()); String path = GovernanceUtils.getArtifactPath(registry, artifactId); if (path != null) {
String roles[] = realm.getUserStoreManager().getRoleListOfUser(username); return roles; } catch (Exception e) {