Allura/allura/lib/security.py
def load_user_roles(self, user_id, *project_ids):
        '''Load the credentials with all user roles for a set of projects'''
        # Don't reload roles
        project_ids = [
            pid for pid in project_ids if self.users.get((user_id, pid)) is None]
        if not project_ids:
            return
        if user_id is None:
            q = self.project_role.find({
                'user_id': None,
                'project_id': {'$in': project_ids},
                'name': '*anonymous'})
        else:
            q0 = self.project_role.find({
                'user_id': None,
                'project_id': {'$in': project_ids},
                'name': {'$in': ['*anonymous', '*authenticated']}})
            q1 = self.project_role.find({
                'user_id': user_id,
                'project_id': {'$in': project_ids},
                'name': None})
            q = chain(q0, q1)
        roles_by_project = dict((pid, []) for pid in project_ids)
        for role in q:
            roles_by_project[role['project_id']].append(role)
        for pid, roles in roles_by_project.iteritems():
            self.users[user_id, pid] = RoleCache(self, roles)
Load the credentials with all user roles for a set of projects
Load the credentials with all user roles for a set of projects
Load the credentials with all user roles for a set of projects
def load_user_roles(self, user_id, *project_ids):
        project_ids = [
            pid for pid in project_ids if self.users.get((user_id, pid)) is None]
        if not project_ids:
            return
        if user_id is None:
            q = self.project_role.find({
                'user_id': None,
                'project_id': {'$in': project_ids},
                'name': '*anonymous'})
        else:
            q0 = self.project_role.find({
                'user_id': None,
                'project_id': {'$in': project_ids},
                'name': {'$in': ['*anonymous', '*authenticated']}})
            q1 = self.project_role.find({
                'user_id': user_id,
                'project_id': {'$in': project_ids},
                'name': None})
            q = chain(q0, q1)
        roles_by_project = dict((pid, []) for pid in project_ids)
        for role in q:
            roles_by_project[role['project_id']].append(role)
        for pid, roles in roles_by_project.iteritems():
            self.users[user_id, pid] = RoleCache(self, roles)
def load_user_roles ( self , user_id , * project_ids ) : project_ids = [ pid for pid in project_ids if self . users . get ( ( user_id , pid ) ) is None ] if not project_ids : return if user_id is None : q = self . project_role . find ( { 'user_id' : None , 'project_id' : { '$in' : project_ids } , 'name' : '*anonymous' } ) else : q0 = self . project_role . find ( { 'user_id' : None , 'project_id' : { '$in' : project_ids } , 'name' : { '$in' : [ '*anonymous' , '*authenticated' ] } } ) q1 = self . project_role . find ( { 'user_id' : user_id , 'project_id' : { '$in' : project_ids } , 'name' : None } ) q = chain ( q0 , q1 ) roles_by_project = dict ( ( pid , [ ] ) for pid in project_ids ) for role in q : roles_by_project [ role [ 'project_id' ] ] . append ( role ) for pid , roles in roles_by_project . iteritems ( ) : self . users [ user_id , pid ] = RoleCache ( self , roles )
Load the credentials with all user roles for a set of projects
Load the credentials with all user roles for a set of projects
'''Load the credentials with all user roles for a set of projects''' # Don't reload roles
self
user_id