/** * Finds the set of groups where a given user is a member. Note that * inheritable ancestors groups are also returned. * * @param user * The member user. * @return The set of groups. */ public Set<Group> findGroups(User user) { return findGroups(user, true); }
@Override protected User createUser(String identifier, Request request, Response response) { User result = new User(identifier); // Find the reference user User user = findUser(identifier); if (user != null) { // Copy the properties of the reference user result.setEmail(user.getEmail()); result.setFirstName(user.getFirstName()); result.setLastName(user.getLastName()); } return result; }
/** * Returns the user identifier. * * @see #getIdentifier() */ public String getName() { return getIdentifier(); }
/** * @return the name */ @Override public String getName() { return this.role.getName(); }
/** * Constructor. */ public MemoryRealm() { setVerifier(new DefaultVerifier()); setEnroler(new DefaultEnroler()); this.rootGroups = new CopyOnWriteArrayList<Group>(); this.roleMappings = new CopyOnWriteArrayList<RoleMapping>(); this.users = new CopyOnWriteArrayList<User>(); }
@Override protected int beforeHandle(Request request, Response response) { if (authorize(request, response)) { return authorized(request, response); } return unauthorized(request, response); }
/** * Maps a user defined in a component to a role defined in the application. * * @param user * The source user. * @param application * The parent application. Can't be null. * @param roleName * The target role name. * @throws IllegalArgumentException * If application is null. */ public void map(User user, Application application, String roleName) { map(user, Role.get(application, roleName, null)); }
@Override public int verify(String identifier, char[] secret) { return compare(secret, getLocalSecret(identifier)) ? RESULT_VALID : RESULT_INVALID; }
@Override public Restlet createInboundRoot() { Restlet restlet = this.jaxRsRestlet; if (this.authenticator != null) { this.authenticator.setNext(restlet); restlet = this.authenticator; } return restlet; }
@Override public String toString() { return getName(); }
/** * Unmaps a group defined in a component from a role defined in the * application. * * @param group * The source group. * @param role * The target role. */ public void unmap(Group group, Role role) { unmap((Object) group, role); }
/** * Starts the realms. * * @throws Exception */ protected synchronized void startRealms() throws Exception { if (this.realms != null) { for (Realm realm : this.realms) { realm.start(); } } }
/** * Stops the realms. * * @throws Exception */ protected synchronized void stopRealms() throws Exception { if (this.realms != null) { for (Realm realm : this.realms) { realm.stop(); } } }
/** * @return the description */ @Override public String getDescription() { return this.role.getDescription(); }
@Override public String toString() { return getIdentifier(); } }
public void DeleteOrganizationService(){ private MyClass myClass; ... public void delete(Organization organization) { myClass.deleteOrganization(organization); /*Delete related users*/ for (User user : organization.getUsers()) { myClass.deleteUser(user); } } }
/** * Unmaps a user defined in a component from a role defined in the * application. * * @param user * The source user. * @param role * The target role. */ public void unmap(User user, Role role) { unmap((Object) user, role); }
@Override public String toString() { return getIdentifier(); } }