Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add groups permission as an available scope in oidc provider #151

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Features (planned)
Configuring a development environment
-------------------------------------

Dependencies:
gettext

Run the following commands in order to setup a development environment on a local computer::

make update
Expand Down
16 changes: 16 additions & 0 deletions xorgauth/accounts/oidc_provider_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class XorgScopeClaims(ScopeClaims):
_("X Groups"),
_("The list of the X Groups you belong to")
)
info_xorg_groups_perm = (
_("X Groups Perms"),
_("The list of the X Groups you belong to, suffix with admin if you are an admin")
)
info_xorg_study_years = (
_("Study year"),
_("The year of your study at the Ecole polytechnique")
Expand All @@ -47,6 +51,18 @@ def scope_xorg_groups(self):
}
return dic

def scope_xorg_groups_perm(self):
groups = []
for g in self.user.groups.all():
name = g.group.shortname
groups.append(name)
if g.perms == 'admin':
groups.append(name + '_admin')
dic = {
'x_groups_perm': groups
}
return dic

def scope_xorg_study_years(self):
return {
'study_years': [self.user.study_year],
Expand Down