Changeset 6860
- Timestamp:
- 12/01/15 08:08:02 (9 years ago)
- 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 18 18 @XmlElement 19 19 private String displayName; 20 @XmlElement 21 private boolean isAdmin; 20 22 21 23 public AuthenticationInfo() { … … 26 28 } 27 29 28 public AuthenticationInfo(UserCredentials userInfo ) {30 public AuthenticationInfo(UserCredentials userInfo, boolean isAdmin) { 29 31 this.authenticated = (userInfo != null); 30 32 if (userInfo != null) { 31 33 this.username = userInfo.getPrincipalName(); 32 34 this.displayName = userInfo.getDisplayName(); 35 this.isAdmin = isAdmin; 33 36 } 34 37 } … … 46 49 } 47 50 51 public boolean isIsAdmin() { 52 return isAdmin; 53 } 54 48 55 } -
ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/AuthenticationRestService.java
r5975 r6860 3 3 import clarin.cmdi.componentregistry.AuthenticationRequiredException; 4 4 import clarin.cmdi.componentregistry.ComponentRegistryFactory; 5 import clarin.cmdi.componentregistry.Configuration; 5 6 import clarin.cmdi.componentregistry.UserCredentials; 6 7 import clarin.cmdi.componentregistry.impl.database.ValidationException; … … 27 28 import org.slf4j.Logger; 28 29 import org.slf4j.LoggerFactory; 30 import org.springframework.beans.factory.annotation.Autowired; 29 31 import org.springframework.stereotype.Service; 30 32 import org.springframework.transaction.annotation.Transactional; … … 74 76 @Context 75 77 private UriInfo uriInfo; 78 @Autowired 79 private Configuration configuration; 76 80 77 81 @GET … … 89 93 authInfo = new AuthenticationInfo(false); 90 94 } else { 91 authInfo = new AuthenticationInfo(new UserCredentials(userPrincipal) );95 authInfo = new AuthenticationInfo(new UserCredentials(userPrincipal), configuration.isAdminUser(userPrincipal)); 92 96 } 93 97
Note: See TracChangeset
for help on using the changeset viewer.