

def _GetGroupMembersAndPermissions(self):
    "Returns a dict of users from settings.GROUPS with desired permissions.\n\n    GROUPS is a dict of permission types, where each type contains a list of\n    groups for that given type with a sequence of permissions members of that\n    group should have. This function essentially expands the group membership\n    and returns a dict of users and the various permissions they have as a\n    result of being in one or more of the groups.\n\n    Returns:\n      dict like the following:\n    {\n      'user1@example.com': {'permission_type1': set(['read', 'write'])},\n      'user2@example.com': {'permission_type1': set(['read', 'write'])},\n      'user3@example.com': {'permission_type1': set(['read', 'write', 'list']),\n                            'permission_type2': set(['read', 'write'])},\n      }\n    "
    group_users = {
        
    }
    for (permission_type, groups) in settings.GROUPS.iteritems():
        groups = [(g, set(p)) for (g, p) in groups]
        for (group, perms) in groups:
            for user in self._GetGroupMembers(group):
                if (user not in group_users):
                    group_users[user] = {
                        permission_type: perms,
                    }
                elif (permission_type not in group_users[user]):
                    group_users[user][permission_type] = perms
                else:
                    group_users[user][permission_type] = group_users[user][permission_type].union(perms)
    return group_users

dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/cron/group_sync.py GroupSync._GetGroupMembersAndPermissions/original