public Role createRole(final String name) { if (name == null) { return null; } return new RoleImpl(name); }
public Role createRole(final String name) { if (name == null) { return null; } return new RoleImpl(name); }
public static Role createRole(final String name) { if (name == null) { return null; } return new RoleImpl(name); }
/** * Registers given <code>role</code> into the registry */ public void registerRole(String role) { this.roles.add(new RoleImpl(role)); }
public AuthorizationPolicyBuilder role(String role) { _currentGroup = null; _currentRole = roles.get(role); if (_currentRole == null) { roles.put(role, _currentRole = new RoleImpl(role)); } return this; }
private User getUser() { try { return authenticationService.getUser(); } catch (final IllegalStateException ex) { return new UserImpl("system", asList(new RoleImpl("admin"))); } } }
private User getUser() { try { return authenticationService.getUser(); } catch (final IllegalStateException ex) { return new UserImpl("system", asList(new RoleImpl("admin"))); } } }
@Override public Set<Role> extractSimpleRoles(final RestrictedAccess annotation) { final Set<Role> simpleRoles = new HashSet<Role>(annotation.roles().length); for (final String roleName : annotation.roles()) { //XXX Maybe we should cache and reuse RoleImpls? simpleRoles.add(new RoleImpl(roleName)); } return simpleRoles; }
private User getUserFromIdentityProvider() { List<String> roleStrList = identityProvider.getRoles(); List<Role> roles = new ArrayList<Role>(roleStrList.size()); for( String roleStr : roleStrList ) { roles.add( new RoleImpl(roleStr)); } return new UserImpl( identityProvider.getName(), roles ); }
private User getUserFromIdentityProvider() { List<String> roleStrList = identityProvider.getRoles(); List<Role> roles = new ArrayList<Role>(roleStrList.size()); for( String roleStr : roleStrList ) { roles.add( new RoleImpl(roleStr)); } return new UserImpl( identityProvider.getName(), roles ); }
@Test public void testSessionCleanupNPE() { final CleanupSecurityCacheSessionListener listener = new CleanupSecurityCacheSessionListener(); final User user = new UserImpl("user", ImmutableSet.of(new RoleImpl("author"))); when(evt.getSession()).thenReturn(session); when(session.getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME)).thenReturn(user); listener.sessionDestroyed(evt); } }
@OnStartup public void onStartup( final ObservablePath path, final PlaceRequest place ) { if ( !identity.getRoles().contains( new RoleImpl( AppRoles.ADMIN.getName() ) ) ) { makeReadOnly( place ); } super.onStartup( path, place ); }
public boolean flush() { assert this.isEditMode; this.isFlushed = true; roleEditor.flush(); // Obtain the editor's values final String name = roleEditor.name(); // Create a new resulting instance role = new RoleImpl(name); // Validate the instance and set delegate violations, if any, to the editors hierarchy. Set<ConstraintViolation<Role>> violations = userSystemManager.rolesValidator().validate(role); roleEditor.setViolations(violations); return violations == null || violations.isEmpty(); }
@Test public void testSessionCleanupNPE() { final CleanupSecurityCacheSessionListener listener = new CleanupSecurityCacheSessionListener(); final User user = new UserImpl("user", ImmutableSet.of(new RoleImpl("author"))); when(evt.getSession()).thenReturn(session); when(session.getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME)).thenReturn(user); listener.sessionDestroyed(evt); } }
private Set<Role> getRolesOfCurrentUser() { Set<Role> roles = new HashSet<Role>(); if (identity.isLoggedIn()) { RelationshipQuery<Grant> query = relationshipManager.createRelationshipQuery(Grant.class); query.setParameter(Grant.ASSIGNEE, identity.getAccount()); for (final Grant grant : query.getResultList()) { roles.add(new RoleImpl(grant.getRole().getName())); } } return roles; }
private Set<Role> getRolesOfCurrentUser() { Set<Role> roles = new HashSet<Role>(); if (identity.isLoggedIn()) { RelationshipQuery<Grant> query = relationshipManager.createRelationshipQuery(Grant.class); query.setParameter(Grant.ASSIGNEE, identity.getAccount()); for (final Grant grant : query.getResultList()) { roles.add(new RoleImpl(grant.getRole().getName())); } } return roles; }
@Test public void testUserPermissions() { testPermissions(new RoleImpl("user"), USER_GRANTED, HOME_PERSPECTIVE, ACCESS_DENIED, ACCESS_GRANTED); }
@Test public void testProcessAdminPermissions() { testPermissions(new RoleImpl("process-admin"), PROCESS_ADMIN_GRANTED, HOME_PERSPECTIVE, ACCESS_DENIED, ACCESS_GRANTED); }
@Test public void testManagerPermissions() { testPermissions(new RoleImpl("manager"), MANAGER_GRANTED, HOME_PERSPECTIVE, ACCESS_DENIED, ACCESS_GRANTED); }
@Test public void testUserPermissions() { testPermissions(new RoleImpl("user"), USER_GRANTED, HOME_PERSPECTIVE, ACCESS_DENIED, ACCESS_GRANTED); }