Esempio n. 1
0
    def GET_group(self, owner):
        groupinfo = web.config.db.select("groups",
                                         dict(u=owner),
                                         where="id=$u").list()
        if len(groupinfo) != 1:
            return web.internalerror("Couldn't find user information")

        repos = queries.repos_for_owner(owner).list()
        for r in repos:
            repo = Repo(
                os.path.join(web.config.reporoot, r.owner, r.id + ".git"))
            r.lastUpdate = gitHelper.get_last_commit_time(repo)

        members = queries.members_for_group(owner).list()
        role = [
            m['role'] for m in members if m['id'] == web.config.session.userid
        ]

        if len(role) == 1:
            users = web.config.db.select('users', what='id,name').list()
            users = [
                u for u in users if u.id not in [m['id'] for m in members]
            ]
            return render.groupPageForMembers(group=groupinfo[0],
                                              repos=repos,
                                              members=members,
                                              role=role[0],
                                              users=users)
        else:
            return render.groupPageForVisitors(group=groupinfo[0],
                                               repos=repos,
                                               members=members)
Esempio n. 2
0
    def GET_group(self, owner):
        groupinfo = web.config.db.select("groups", dict(u=owner), where="id=$u").list()
        if len(groupinfo) != 1:
            return web.internalerror("Couldn't find user information")
        
        repos = queries.repos_for_owner(owner).list()
        for r in repos:
            repo = Repo(os.path.join(web.config.reporoot, r.owner, r.id + ".git"))
            r.lastUpdate = gitHelper.get_last_commit_time(repo)
        
        members = queries.members_for_group(owner).list()

        return render.groupPage(group=groupinfo[0], repos=repos, members=members)   
Esempio n. 3
0
    def GET_user(self, owner):
        userinfo = web.config.db.select("users", dict(u=owner), where="id=$u").list()
        if len(userinfo) != 1:
            return web.internalerror("Couldn't find user information")

        userinfo = userinfo[0]
        auth = [m for m in web.config.auth.methods if m.get_usertype() == userinfo.type][0]
        userinfo.joined = auth.get_join_date(userinfo.identifier, web.config)

        repos = queries.viewable_repos_for_user(owner, web.config.session.userid).list()
        for r in repos:
            repo = Repo(os.path.join(web.config.reporoot, r.owner, r.repoid + ".git"))
            r.lastUpdate = gitHelper.get_last_commit_time(repo)

        groups = queries.groups_with_membership_for_user(owner).list()

        return render.userPage(user=userinfo, repos=repos, groups=groups)
Esempio n. 4
0
    def GET_group(self, owner):
        groupinfo = web.config.db.select("groups", dict(u=owner), where="id=$u").list()
        if len(groupinfo) != 1:
            return web.internalerror("Couldn't find user information")
        
        repos = queries.repos_for_owner(owner).list()
        for r in repos:
            repo = Repo(os.path.join(web.config.reporoot, r.owner, r.id + ".git"))
            r.lastUpdate = gitHelper.get_last_commit_time(repo)
        
        members = queries.members_for_group(owner).list()
        role = [m['role'] for m in members if m['id'] == web.config.session.userid]

        if len(role) == 1:
            users = web.config.db.select('users', what='id,name').list()
            users = [u for u in users if u.id not in [m['id'] for m in members]]
            return render.groupPageForMembers(group=groupinfo[0], repos=repos, members=members, role=role[0], users=users)
        else:
            return render.groupPageForVisitors(group=groupinfo[0], repos=repos, members=members)
Esempio n. 5
0
    def GET_user(self, owner):
        userinfo = web.config.db.select("users", dict(u=owner),
                                        where="id=$u").list()
        if len(userinfo) != 1:
            return web.internalerror("Couldn't find user information")

        userinfo = userinfo[0]
        auth = [
            m for m in web.config.auth.methods
            if m.get_usertype() == userinfo.type
        ][0]
        userinfo.joined = auth.get_join_date(userinfo.identifier, web.config)

        repos = queries.viewable_repos_for_user(
            owner, web.config.session.userid).list()
        for r in repos:
            repo = Repo(
                os.path.join(web.config.reporoot, r.owner, r.repoid + ".git"))
            r.lastUpdate = gitHelper.get_last_commit_time(repo)

        groups = queries.groups_with_membership_for_user(owner).list()

        return render.userPage(user=userinfo, repos=repos, groups=groups)