Exemplo n.º 1
0
 def get_allowed_instances(cls, user):
     """
     returns all instances in which the given user has permission to send a
     message to all users
     """
     if has('global.message'):
         return Instance.all()
     else:
         return [m.instance for m in user.memberships
                 if (m.instance is not None
                     and m.instance.is_authenticated
                     and 'instance.message' in m.group.permissions)]
Exemplo n.º 2
0
 def _get_allowed_instances(cls, user):
     """
     returns all instances in which the given user has permission to send a
     message to all users
     """
     if has('global.message'):
         return Instance.all()
     else:
         perm = Permission.find('instance.message')
         instances = [m.instance for m in user.memberships
                      if (m.instance is not None
                          and m.instance.is_authenticated
                          and perm in m.group.permissions)]
         return sorted(instances, key=lambda i: i.label)
Exemplo n.º 3
0
 def _get_allowed_instances(cls, user):
     """
     returns all instances in which the given user has permission to send a
     message to all users
     """
     if has('global.message'):
         return Instance.all()
     else:
         perm = Permission.find('instance.message')
         return [
             m.instance for m in user.memberships
             if (m.instance is not None and m.instance.is_authenticated
                 and perm in m.group.permissions)
         ]
Exemplo n.º 4
0
 def _get_allowed_instances(cls, user):
     """
     returns all instances in which the given user has permission to send a
     message to all users
     """
     if has('global.message'):
         return Instance.all(include_hidden=True)
     else:
         perm = Permission.find('instance.message')
         instances = [
             m.instance for m in user.memberships
             if (m.instance is not None and m.instance.is_authenticated
                 and perm in m.group.permissions)
         ]
         return sorted(instances, key=lambda i: i.label)