Beispiel #1
0
 def can_manage_vc(self, user):
     """Checks if a user has management rights on this VC system"""
     if user.isAdmin():
         return True
     return any(
         principal.containsUser(user) for principal in retrieve_principals(
             self.settings.get('managers')))
Beispiel #2
0
 def _value(self):
     if self.serializable:
         data = retrieve_principals(self._get_data(), legacy=False)
     else:
         data = self._get_data()
     data.sort(key=lambda x: x.name.lower())
     return [serialize_user(x) if isinstance(x, User) else serialize_group(x) for x in data]
Beispiel #3
0
def rb_is_admin(user):
    """Checks if the user is a room booking admin"""
    from indico.modules.rb import settings as rb_settings
    if user.user.is_admin:
        return True
    principals = retrieve_principals(rb_settings.get('admin_principals'))
    return any(principal.containsUser(user) for principal in principals)
Beispiel #4
0
def rb_is_admin(user):
    """Checks if the user is a room booking admin"""
    from indico.modules.rb import settings as rb_settings
    if user.user.is_admin:
        return True
    principals = retrieve_principals(rb_settings.get('admin_principals'))
    return any(principal.containsUser(user) for principal in principals)
Beispiel #5
0
def rb_check_user_access(user):
    """Checks if the user has access to the room booking system"""
    from indico.modules.rb import settings

    if user.isRBAdmin():
        return True
    principals = retrieve_principals(settings.get('authorized_principals', []))
    if not principals:  # everyone has access
        return True
    return any(principal.containsUser(user) for principal in principals)
Beispiel #6
0
def rb_check_user_access(user):
    """Checks if the user has access to the room booking system"""
    from indico.modules.rb import settings

    if user.isRBAdmin():
        return True
    principals = retrieve_principals(settings.get('authorized_principals', []))
    if not principals:  # everyone has access
        return True
    return any(principal.containsUser(user) for principal in principals)
Beispiel #7
0
 def _value(self):
     if self.serializable:
         data = retrieve_principals(self._get_data(), legacy=False)
     else:
         data = self._get_data()
     data.sort(key=lambda x: x.name.lower())
     return [
         serialize_user(x) if isinstance(x, User) else serialize_group(x)
         for x in data
     ]
Beispiel #8
0
    def can_manage_vc_rooms(self, user, event):
        """Checks if a user can manage vc rooms on an event"""
        if self.can_manage_vc(user):
            return True

        acl = self.settings.get('acl')
        if not acl:
            return True

        principals = retrieve_principals(acl)
        return any(principal.containsUser(user) for principal in principals)
Beispiel #9
0
    def can_manage_vc_rooms(self, user, event):
        """Checks if a user can manage vc rooms on an event"""
        if self.can_manage_vc(user):
            return True

        acl = self.settings.get('acl')
        if not acl:
            return True

        principals = retrieve_principals(acl)
        return any(principal.containsUser(user) for principal in principals)
Beispiel #10
0
 def can_manage_vc(self, user):
     """Checks if a user has management rights on this VC system"""
     if user.isAdmin():
         return True
     return any(principal.containsUser(user) for principal in retrieve_principals(self.settings.get('managers')))
Beispiel #11
0
 def _value(self):
     return map(fossilize, retrieve_principals(self.data or []))
Beispiel #12
0
 def _value(self):
     if self.serializable:
         return map(fossilize, retrieve_principals(self._get_data()))
     else:
         data = sorted(self._get_data(), key=lambda x: (x.last_name if isinstance(x, User) else x.name).lower())
         return fossilize(x.as_avatar if isinstance(x, User) else x.as_legacy_group for x in data)
Beispiel #13
0
 def _value(self):
     return map(fossilize, retrieve_principals(self._get_data()))
Beispiel #14
0
 def _value(self):
     return map(fossilize, retrieve_principals(self.data or []))