예제 #1
0
파일: massmessage.py 프로젝트: whausen/part
 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)]
예제 #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)
예제 #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)
         ]
예제 #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)