@Override protected String getEntityId(final Role entity) { return entity.getName(); }
@Override protected String getEntityIdentifier(final Role entity) { return entity.getName(); }
@Override protected String getEntityId(final Role entity) { return entity.getName(); }
@Override protected String getIdentifier(Role entity) { return entity.getName(); } }
public boolean hasAnyRoles(String... roleNames) { for (Role role : roles) { for (String roleName : roleNames) { if (roleName.equals(role.getName())) { return true; } } } return false; }
/** * Gets a a role instance by its name or null if not found. */ public Role getRegisteredRole(String name) { for (Role role : roles) { if (role.getName().equals(name)) { return role; } } return null; }
public void write(Role role, String homePerspectiveId, Map out) { String key = ROLE + "." + role.getName() + "." + HOME; out.remove(key); if (homePerspectiveId != null) { out.put(key, homePerspectiveId); } }
public void write(Role role, int priority, Map out) { String key = ROLE + "." + role.getName() + "." + PRIORITY; out.put(key, Integer.toString(priority)); }
public static Set<String> rolesToString(final Set<Role> roles) { if (null != roles && !roles.isEmpty()) { final Set<String> result = new HashSet<String>(roles.size()); for (final Role role : roles) { result.add(role.getName()); } return result; } return new HashSet<String>(); }
protected Set<String> getRoleNames() { final Set<String> result = new LinkedHashSet<String>(user.getRoles().size()); for (final Role role : user.getRoles()) { result.add(role.getName()); } return result; }
protected Set<String> getRoleNames() { final Set<String> result = new LinkedHashSet<String>(user.getRoles().size()); for (final Role role : user.getRoles()) { result.add(role.getName()); } return result; }
public static Role mockRole(String name) { Role role = mock(Role.class); when(role.getName()).thenReturn(name); return role; }
public static Role mockRole(String name) { Role role = mock(Role.class); when(role.getName()).thenReturn(name); return role; }
public void write(Role role, PermissionCollection permissions, Map out) { for (Permission p : permissions.collection()) { boolean granted = p.getResult() != null && p.getResult().equals(AuthorizationResult.ACCESS_GRANTED); String key = ROLE + "." + role.getName() + "." + PERMISSION + "." + p.getName(); out.put(key, Boolean.toString(granted)); } }
public List<Menus> getRoles() { final Set<Role> roles = identity.getRoles(); final List<Menus> result = new ArrayList<>(roles.size()); result.add(MenuFactory.newSimpleItem(constants.LogOut()).respondsWith(new LogoutCommand()).endMenu().build()); for (final Role role : roles) { if (!role.getName().equals("IS_REMEMBER_ME")) { result.add(MenuFactory.newSimpleItem(constants.Role() + ": " + role.getName()).endMenu().build()); } } return result; }
protected List<Role> buildRolesList(final int size) { final List<Role> groups = new ArrayList<Role>(); for (int x = 0; x < size; x++) { final Role g = mock(Role.class); when(g.getName()).thenReturn(getRoleIdentifier(x)); groups.add(g); } return groups; }
protected void setDirty(final boolean isDirty) { this.isDirty = isDirty; view.setSaveButtonVisible(isDirty); view.setSaveButtonEnabled(isDirty); view.setCancelButtonVisible(true); if (isDirty) { view.showNotification(UsersManagementWidgetsConstants.INSTANCE.roleModified(BaseRoleEditorWorkflow.this.role.getName())); } else { view.clearNotifications(); } }
protected void setDirty(final boolean isDirty) { this.isDirty = isDirty; view.setSaveButtonVisible(isDirty); view.setSaveButtonEnabled(isDirty); view.setCancelButtonVisible(true); if (isDirty) { view.showNotification(UsersManagementWidgetsConstants.INSTANCE.roleModified(BaseRoleEditorWorkflow.this.role.getName())); } else { view.clearNotifications(); } }
@Test public void testCreateRole() { final String testId = "id1"; final Role role = SecurityManagementUtils.createRole(testId); assertNotNull(role); final String name = role.getName(); assertEquals(name, testId); }
@Test public void testCreateRole() { final String testId = "id1"; final Role role = SecurityManagementUtils.createRole(testId); assertNotNull(role); final String name = role.getName(); assertEquals(name, testId); }