Skip to content
Snippets Groups Projects
Commit 186aeac6 authored by srosse's avatar srosse
Browse files

OO-1398: check against null identity and repository entry

parent 685f7ea1
No related branches found
No related tags found
No related merge requests found
......@@ -239,9 +239,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
return businessGroupService.isIdentityInBusinessGroup(identity, null, true, false, getCourseEntry());
}
/**
* @see org.olat.course.groupsandrights.CourseGroupManager#isIdentityCourseCoach(org.olat.core.id.Identity)
*/
@Override
public boolean isIdentityCourseParticipant(Identity identity) {
boolean participant = repositoryService.hasRole(identity, getCourseEntry(), GroupRoles.participant.name());
if (participant) {// don't check any further
......@@ -250,18 +248,13 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
return businessGroupService.isIdentityInBusinessGroup(identity, null, false, true, getCourseEntry());
}
/**
* @see org.olat.course.groupsandrights.CourseGroupManager#isIdentityCourseAdministrator(org.olat.core.id.Identity)
*/
@Override
public boolean isIdentityCourseAdministrator(Identity identity) {
// not really a group management method, for your convenience we have a
// shortcut here...
return repositoryService.hasRole(identity, getCourseEntry(), GroupRoles.owner.name());
}
/**
* @see org.olat.course.groupsandrights.CourseGroupManager#deleteCourseGroupmanagement()
*/
@Override
public void deleteCourseGroupmanagement() {
//delete permission group to course
......
......@@ -107,6 +107,7 @@ public class RepositoryEntryRelationDAO {
* @return
*/
public boolean hasRole(IdentityRef identity, RepositoryEntryRef re, String... roles) {
if(identity == null || re == null || re.getKey() == null) return false;
List<String> roleList = GroupRoles.toList(roles);
StringBuilder sb = new StringBuilder();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment