Changeset 5556 for ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
- Timestamp:
- 08/18/14 09:50:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
r5553 r5556 155 155 } 156 156 } 157 158 @Override 159 public Number makeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException{157 158 @Override 159 public Number makeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException { 160 160 RegistryUser regOwner = userDao.getPrincipalNameById(registryOwner.getId()); 161 if (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) ||162 configuration.isAdminUser(regOwner.getPrincipalName())) {163 return groupService.makeMember(principalName, groupName);161 if (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) 162 || configuration.isAdminUser(regOwner.getPrincipalName())) { 163 return groupService.makeMember(principalName, groupName); 164 164 } else { 165 165 throw new UserUnauthorizedException("The registry owner is not the admin or not the owner of the group and cannot add users to the group"); 166 166 } 167 167 } 168 168 169 169 // @Override 170 170 // public long removeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException{ … … 177 177 // } 178 178 // } 179 180 181 @Override 182 public List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException, UserUnauthorizedException { 179 @Override 180 public List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException { 183 181 try { 184 182 switch (registrySpace) { … … 234 232 235 233 @Override 236 public List<ComponentDescription> getComponentDescriptions() throws ComponentRegistryException, UserUnauthorizedException {234 public List<ComponentDescription> getComponentDescriptions() throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException { 237 235 try { 238 236 switch (registrySpace) { … … 861 859 862 860 private List<ComponentDescription> getComponentDescriptionsInGroup(Number groupId) 863 throws ComponentRegistryException, UserUnauthorizedException {861 throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException { 864 862 865 863 String principalName = userDao.getPrincipalNameById(registryOwner.getId()).getPrincipalName(); 866 867 if (!groupService.userGroupMember(principalName, groupId.toString())) { 864 String groupName = groupService.getGroupNameById(groupId.longValue()); 865 if (!groupService.userGroupMember(principalName, groupId.toString()) 866 && !groupService.isUserOwnerOfGroup(groupName, principalName)) { 868 867 throw new UserUnauthorizedException("The user \'" + principalName + "\' does not have access to components of the group " + groupId); 869 868 } … … 880 879 } 881 880 882 private List<ProfileDescription> getProfileDescriptionsInGroup(Number groupId) throws ComponentRegistryException, UserUnauthorizedException {881 private List<ProfileDescription> getProfileDescriptionsInGroup(Number groupId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException { 883 882 884 883 String principalName = userDao.getPrincipalNameById(registryOwner.getId()).getPrincipalName(); 885 886 if (!groupService.userGroupMember(principalName, groupId.toString())) { 884 String groupName = groupService.getGroupNameById(groupId.longValue()); 885 if (!groupService.userGroupMember(principalName, groupId.toString()) 886 && !groupService.isUserOwnerOfGroup(groupName, principalName)) { 887 887 throw new UserUnauthorizedException("The user \'" + principalName + "\' does not have access to profiles of the group " + groupId); 888 888 } … … 900 900 901 901 @Override 902 public List<ProfileDescription> getProfileDescriptionsForMetadaEditor(Number groupId) throws UserUnauthorizedException, 903 ComponentRegistryException { 902 public List<ProfileDescription> getProfileDescriptionsForMetadaEditor(Number groupId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException { 904 903 return this.getProfileDescriptionsInGroup(groupId.longValue()); 905 904 } … … 984 983 } 985 984 } 986 987 988 985 }
Note: See TracChangeset
for help on using the changeset viewer.