- public String getHomePath() {
- return homePath;
- }
-
- public static JcrUserDetails argeoUserToJcrUserDetails(
- JcrArgeoUser argeoUser) {
- try {
- List<GrantedAuthority> gas = new ArrayList<GrantedAuthority>();
- for (String role : argeoUser.getRoles())
- gas.add(new GrantedAuthorityImpl(role));
- return new JcrUserDetails(argeoUser.getHome().getPath(),
- argeoUser.getUsername(), argeoUser.getPassword(),
- argeoUser.getEnabled(), true, true, true,
- gas.toArray(new GrantedAuthority[gas.size()]));
- } catch (Exception e) {
- throw new ArgeoException("Cannot convert " + argeoUser
- + " to JCR user details", e);
+ public JcrUserDetails(Node userProfile, String password,
+ GrantedAuthority[] authorities) throws RepositoryException {
+ super(
+ userProfile.getProperty(ARGEO_USER_ID).getString(),
+ password,
+ userProfile.getProperty(ARGEO_ENABLED).getBoolean(),
+ userProfile.getProperty(ARGEO_ACCOUNT_NON_EXPIRED).getBoolean(),
+ userProfile.getProperty(ARGEO_CREDENTIALS_NON_EXPIRED)
+ .getBoolean(), userProfile.getProperty(
+ ARGEO_ACCOUNT_NON_LOCKED).getBoolean(), authorities);
+ // human readable name
+ if (userProfile.hasProperty(Property.JCR_TITLE)) {
+ displayName = userProfile.getProperty(Property.JCR_TITLE)
+ .getString();
+ if (displayName.trim().equals(""))
+ displayName = null;