test_class.file: openmeetings-db/src/test/java/org/apache/openmeetings/db/util/TestAuthLevelUtil.java
test_class.identifier: TestAuthLevelUtil
test_case.body: @Test
  	void testAdmin() {
  		User u = new User();
  		u.setRights(Set.of(User.Right.ADMIN));
  		Set<Room.Right> rights = getRoomRight(u, new Room(), null, 0);
  		assertEquals(1, rights.size(), "Result should NOT be empty");
  		assertTrue(rights.contains(Room.Right.SUPER_MODERATOR), "Result should be super moderator");
  	}
test_case.class_method_signature: TestAuthLevelUtil.testAdmin()
test_case.full_signature: @Test void testAdmin()
test_case.identifier: testAdmin
test_case.invocations: setRights of getRoomRight assertEquals size assertTrue contains
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAdmin()
focal_class.declarator: log = LoggerFactory.getLogger(AuthLevelUtil.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(AuthLevelUtil.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: openmeetings-db/src/main/java/org/apache/openmeetings/db/util/AuthLevelUtil.java
focal_class.identifier: AuthLevelUtil
focal_class.class_method_signature: AuthLevelUtil.AuthLevelUtil()
focal_class.full_signature: private  AuthLevelUtil()
focal_class.identifier: AuthLevelUtil
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  AuthLevelUtil()
focal_class.class_method_signature: AuthLevelUtil.check(Set<User.Right> rights, User.Right level)
focal_class.full_signature: public static boolean check(Set<User.Right> rights, User.Right level)
focal_class.identifier: check
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights, User.Right level)
focal_class.return: boolean
focal_class.signature: boolean check(Set<User.Right> rights, User.Right level)
focal_class.class_method_signature: AuthLevelUtil.hasUserLevel(Set<User.Right> rights)
focal_class.full_signature: public static boolean hasUserLevel(Set<User.Right> rights)
focal_class.identifier: hasUserLevel
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights)
focal_class.return: boolean
focal_class.signature: boolean hasUserLevel(Set<User.Right> rights)
focal_class.class_method_signature: AuthLevelUtil.getRoomRight(User u, Room r, Appointment a, int userCount)
focal_class.full_signature: public static Set<Room.Right> getRoomRight(User u, Room r, Appointment a, int userCount)
focal_class.identifier: getRoomRight
focal_class.modifiers: public static
focal_class.parameters: (User u, Room r, Appointment a, int userCount)
focal_class.return: Set<Room.Right>
focal_class.signature: Set<Room.Right> getRoomRight(User u, Room r, Appointment a, int userCount)
focal_class.class_method_signature: AuthLevelUtil.hasAdminLevel(Set<User.Right> rights)
focal_class.full_signature: public static boolean hasAdminLevel(Set<User.Right> rights)
focal_class.identifier: hasAdminLevel
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights)
focal_class.return: boolean
focal_class.signature: boolean hasAdminLevel(Set<User.Right> rights)
focal_class.class_method_signature: AuthLevelUtil.hasGroupAdminLevel(Set<User.Right> rights)
focal_class.full_signature: public static boolean hasGroupAdminLevel(Set<User.Right> rights)
focal_class.identifier: hasGroupAdminLevel
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights)
focal_class.return: boolean
focal_class.signature: boolean hasGroupAdminLevel(Set<User.Right> rights)
focal_class.class_method_signature: AuthLevelUtil.hasWebServiceLevel(Set<User.Right> rights)
focal_class.full_signature: public static boolean hasWebServiceLevel(Set<User.Right> rights)
focal_class.identifier: hasWebServiceLevel
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights)
focal_class.return: boolean
focal_class.signature: boolean hasWebServiceLevel(Set<User.Right> rights)
focal_class.class_method_signature: AuthLevelUtil.hasLoginLevel(Set<User.Right> rights)
focal_class.full_signature: public static boolean hasLoginLevel(Set<User.Right> rights)
focal_class.identifier: hasLoginLevel
focal_class.modifiers: public static
focal_class.parameters: (Set<User.Right> rights)
focal_class.return: boolean
focal_class.signature: boolean hasLoginLevel(Set<User.Right> rights)
focal_method.body: public static Set<Room.Right> getRoomRight(User u, Room r, Appointment a, int userCount) {
  		Set<Room.Right> result = new HashSet<>();
  		if (u == null) {
  			return result;
  		}
  		if (//admin user get superModerator level, no-one can kick him/her
  			hasAdminLevel(u.getRights())
  			// appointment owner is super moderator
  			|| (r.isAppointment() && a != null && u.getId().equals(a.getOwner().getId())))
  		{
  			result.add(Room.Right.SUPER_MODERATOR);
  		}
  		if (result.isEmpty()) {
  			if (!r.isModerated() && 1 == userCount) {
  				//room is not moderated, first user is moderator!
  				result.add(Room.Right.MODERATOR);
  			}
  			//performing loop here to set possible 'superModerator' right
  			for (RoomModerator rm : r.getModerators()) {
  				if (u.getId().equals(rm.getUser().getId())) {
  					result.add(rm.isSuperModerator() ? Room.Right.SUPER_MODERATOR : Room.Right.MODERATOR);
  					break;
  				}
  			}
  			//no need to loop if client is moderator
  			if (result.isEmpty() && r.getGroups() != null && !r.getGroups().isEmpty()) {
  				for (RoomGroup rg : r.getGroups()) {
  					for (GroupUser gu : u.getGroupUsers()) {
  						if (gu.getGroup().getId().equals(rg.getGroup().getId()) && gu.isModerator()) {
  							result.add(Room.Right.MODERATOR);
  							break;
  						}
  					}
  					if (!result.isEmpty()) {
  						break;
  					}
  				}
  			}
  		}
  		if (Room.Type.CONFERENCE == r.getType() && !result.contains(Room.Right.SUPER_MODERATOR) && !result.contains(Room.Right.MODERATOR) && !result.contains(Room.Right.VIDEO)) {
  			result.add(Room.Right.AUDIO);
  			result.add(Room.Right.VIDEO);
  		}
  		return result;
  	}
focal_method.class_method_signature: AuthLevelUtil.getRoomRight(User u, Room r, Appointment a, int userCount)
focal_method.full_signature: public static Set<Room.Right> getRoomRight(User u, Room r, Appointment a, int userCount)
focal_method.identifier: getRoomRight
focal_method.invocations: hasAdminLevel getRights isAppointment equals getId getId getOwner add isEmpty isModerated add getModerators equals getId getId getUser add isSuperModerator isEmpty getGroups isEmpty getGroups getGroups getGroupUsers equals getId getGroup getId getGroup isModerator add isEmpty getType contains contains contains add add
focal_method.modifiers: public static
focal_method.parameters: (User u, Room r, Appointment a, int userCount)
focal_method.return: Set<Room.Right>
focal_method.signature: Set<Room.Right> getRoomRight(User u, Room r, Appointment a, int userCount)