コード例 #1
0
ファイル: team.py プロジェクト: ynnt/quay
    def get(self, orgname, teamname, parsed_args):
        """
        Retrieve the list of members for the specified team.
        """
        view_permission = ViewTeamPermission(orgname, teamname)
        edit_permission = AdministerOrganizationPermission(orgname)

        if view_permission.can():
            team = None
            try:
                team = model.team.get_organization_team(orgname, teamname)
            except model.InvalidTeamException:
                raise NotFound()

            members = model.organization.get_organization_team_members(team.id)
            invites = []

            if parsed_args["includePending"] and edit_permission.can():
                invites = model.team.get_organization_team_member_invites(
                    team.id)

            data = {
                "name":
                teamname,
                "members":
                [member_view(m)
                 for m in members] + [invite_view(i) for i in invites],
                "can_edit":
                edit_permission.can(),
            }

            if features.TEAM_SYNCING and authentication.federated_service:
                if _syncing_setup_allowed(orgname):
                    data["can_sync"] = {
                        "service": authentication.federated_service,
                    }

                    data["can_sync"].update(authentication.service_metadata())

                sync_info = model.team.get_team_sync_information(
                    orgname, teamname)
                if sync_info is not None:
                    data["synced"] = {
                        "service": sync_info.service.name,
                    }

                    if SuperUserPermission().can():
                        data["synced"].update({
                            "last_updated":
                            format_date(sync_info.last_updated),
                            "config":
                            json.loads(sync_info.config),
                        })

            return data

        raise Unauthorized()
コード例 #2
0
ファイル: team.py プロジェクト: ynnt/quay
def team_view(orgname, team, is_new_team=False):
    view_permission = ViewTeamPermission(orgname, team.name)
    return {
        "name": team.name,
        "description": team.description,
        "can_view": view_permission.can(),
        "role": Team.role.get_name(team.role_id),
        "avatar": avatar.get_data_for_team(team),
        "new_team": is_new_team,
    }
コード例 #3
0
ファイル: team.py プロジェクト: xzwupeng/quay
def team_view(orgname, team, is_new_team=False):
    view_permission = ViewTeamPermission(orgname, team.name)
    return {
        'name': team.name,
        'description': team.description,
        'can_view': view_permission.can(),
        'role': Team.role.get_name(team.role_id),
        'avatar': avatar.get_data_for_team(team),
        'new_team': is_new_team,
    }
コード例 #4
0
def team_view(orgname, team):
    return {
        "name": team.name,
        "description": team.description,
        "role": team.role_name,
        "avatar": avatar.get_data_for_team(team),
        "can_view": ViewTeamPermission(orgname, team.name).can(),
        "repo_count": team.repo_count,
        "member_count": team.member_count,
        "is_synced": team.is_synced,
    }
コード例 #5
0
def team_view(orgname, team):
    return {
        'name': team.name,
        'description': team.description,
        'role': team.role_name,
        'avatar': avatar.get_data_for_team(team),
        'can_view': ViewTeamPermission(orgname, team.name).can(),
        'repo_count': team.repo_count,
        'member_count': team.member_count,
        'is_synced': team.is_synced,
    }