summaryrefslogtreecommitdiffstats
path: root/ipsilon/providers/openid/extensions/fas_teams.py
blob: a726d1f2c2d88fbd8c66560f445d28aead5c2196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright (C) 2014  Ipsilon project Contributors, for licensee see COPYING

from __future__ import absolute_import

from ipsilon.providers.openid.extensions.teams import Teams
from openid_teams import teams


class OpenidExtension(Teams):

    def __init__(self, *pargs):
        super(OpenidExtension, self).__init__('Fedora Teams')

    def _resp(self, request, userdata):
        req = teams.TeamsRequest.fromOpenIDRequest(request)
        if req is None:
            return {}
        if '_FAS_ALL_GROUPS_' in req.requested:
            # We will send all groups the user is a member of
            req.requested = userdata.get('_groups', [])
        data = userdata.get('_groups', [])
        return teams.TeamsResponse.extractResponse(req, data)