Changeset 6860


Ignore:
Timestamp:
12/01/15 08:08:02 (9 years ago)
Author:
Twan Goosen
Message:

auth info: isAdmin

Location:
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/AuthenticationInfo.java

    r5972 r6860  
    1818    @XmlElement
    1919    private String displayName;
     20    @XmlElement
     21    private boolean isAdmin;
    2022
    2123    public AuthenticationInfo() {
     
    2628    }
    2729
    28     public AuthenticationInfo(UserCredentials userInfo) {
     30    public AuthenticationInfo(UserCredentials userInfo, boolean isAdmin) {
    2931        this.authenticated = (userInfo != null);
    3032        if (userInfo != null) {
    3133            this.username = userInfo.getPrincipalName();
    3234            this.displayName = userInfo.getDisplayName();
     35            this.isAdmin = isAdmin;
    3336        }
    3437    }
     
    4649    }
    4750
     51    public boolean isIsAdmin() {
     52        return isAdmin;
     53    }
     54
    4855}
  • ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/AuthenticationRestService.java

    r5975 r6860  
    33import clarin.cmdi.componentregistry.AuthenticationRequiredException;
    44import clarin.cmdi.componentregistry.ComponentRegistryFactory;
     5import clarin.cmdi.componentregistry.Configuration;
    56import clarin.cmdi.componentregistry.UserCredentials;
    67import clarin.cmdi.componentregistry.impl.database.ValidationException;
     
    2728import org.slf4j.Logger;
    2829import org.slf4j.LoggerFactory;
     30import org.springframework.beans.factory.annotation.Autowired;
    2931import org.springframework.stereotype.Service;
    3032import org.springframework.transaction.annotation.Transactional;
     
    7476    @Context
    7577    private UriInfo uriInfo;
     78    @Autowired
     79    private Configuration configuration;
    7680
    7781    @GET
     
    8993            authInfo = new AuthenticationInfo(false);
    9094        } else {
    91             authInfo = new AuthenticationInfo(new UserCredentials(userPrincipal));
     95            authInfo = new AuthenticationInfo(new UserCredentials(userPrincipal), configuration.isAdminUser(userPrincipal));
    9296        }
    9397
Note: See TracChangeset for help on using the changeset viewer.