Esempio n. 1
0
def get_ultimate_container(uid):
    print "%s is a %s" % (uid, reverse[uid][0])
    try:
        g = get_group_for(uid)
        return g
    except Exception, e:
        try:
            u = get_user_for(uid)
            return u
        except:

            dict = reverse[uid]
            try:
                i = dict['parentuid']
                return get_ultimate_contained(i)
            except:
                try:
                    i = dict['mainparentuid']
                    return get_ultimate_contained(i)
                except:
                    print "Can't find ultimate parent for"
                    raise (Exception('huh? %s' % (uid)))
Esempio n. 2
0
def check_group(lst) :
    for group in lst :
        obj_group = get_group_for(group['uid'])
        print group['groupname'], obj_group.get_display_name()
Esempio n. 3
0
from psn_import.utils import maps, reverse, load_file, load_all, title, get_group_for, get_user_for
import ipdb

load_all()

roles = set([])
if __name__ == "__main__":
    groups = maps["Group"]
    print groups[0].keys()
    for group in groups:
        try:
            tg_group = get_group_for(group["uid"])
        except Exception, e:
            print e, group["uid"]
            print group
            import ipdb

            ipdb.set_trace()
            continue
        admin = tg_group.get_admin_group()

        print group["groupname"], tg_group
        print "owner: ", tg_group.get_ref().creator
        print admin

        print "contributors", group["contributors"]
        print "members", group["members"]

        print "roles"
        print group["roles"]
Esempio n. 4
0

for f in maps["files"]:
    # print f.keys()

    flag = True

    title = f["title"]
    print
    if not test_resource(title):
        show(f)
        import ipdb

        ipdb.set_trace()
        if f["mainparenttype"] == "Group":
            print "main group %s" % get_group_for(f["mainparentuid"])
            flag = False

        if f["parenttype"] == "Group":
            print "parent group %s" % get_group_for(f["parentuid"])
            flag = False
        else:
            print "parent is ", f["parenttype"]
            parent = reverse[f["parentuid"]][1]

            if f["parenttype"] == "Group":
                title = parent["title"]

            elif f["parenttype"] == "Folder":
                title = parent["title"]
Esempio n. 5
0
from psn_import.utils import maps, reverse, load_file, load_all, title, get_group_for, get_user_for
import ipdb

load_all()

roles = set([])
if __name__ == '__main__':
    groups = maps['Group']
    print groups[0].keys()
    for group in groups:
        try:
            tg_group = get_group_for(group['uid'])
        except Exception, e:
            print e, group['uid']
            print group
            import ipdb
            ipdb.set_trace()
            continue
        admin = tg_group.get_admin_group()

        print group['groupname'], tg_group
        print "owner: ", tg_group.get_ref().creator
        print admin

        print 'contributors', group['contributors']
        print 'members', group['members']

        print 'roles'
        print group['roles']

        for mk, mv in group['members'].iteritems():