Merge pull request #5432 from FinnStutzenstein/fixSaml

Fix SAML default group ids setting
This commit is contained in:
Emanuel Schütze 2020-06-18 17:56:50 +02:00 committed by GitHub
commit 81b021ab47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

6
.gitignore vendored
View File

@ -14,7 +14,10 @@ node_modules/*
bower_components/* bower_components/*
# OS4-Submodules # OS4-Submodules
openslides-* /openslides-*
# OS3+
/server/
# Local user data (settings, database, media, search index, static files) # Local user data (settings, database, media, search index, static files)
personal_data/* personal_data/*
@ -81,6 +84,7 @@ client/yarn.lock
package-lock.json package-lock.json
client/package-lock.json client/package-lock.json
cypress.json cypress.json
*-version.txt
# System Files # System Files
client/.DS_Store client/.DS_Store

View File

@ -82,6 +82,6 @@ One can overwrite the data extracted from the request headers of saml-requests.
### Default group ids ### Default group ids
If the optional key `default_group_ids` is given, these groups are assigned to If the optional key `defaultGroupIds` is given, these groups are assigned to
each new created user on each saml login. It must be a list of ids. To disable each new created user on each saml login. It must be a list of ids. To disable
this feature, either just do not inlcude this key, or set it to `null`. this feature, either just do not inlcude this key, or set it to `null`.

View File

@ -214,7 +214,7 @@ class SamlSettings:
raise SamlException('The https value must be "on" or "off"') raise SamlException('The https value must be "on" or "off"')
def load_default_group_ids(self, content): def load_default_group_ids(self, content):
self.default_group_ids = content.pop("default_group_ids", None) self.default_group_ids = content.pop("defaultGroupIds", None)
if self.default_group_ids is None: if self.default_group_ids is None:
return return
if not isinstance(self.default_group_ids, list): if not isinstance(self.default_group_ids, list):

View File

@ -145,7 +145,7 @@ class SamlView(View):
) )
group_ids = get_saml_settings().default_group_ids group_ids = get_saml_settings().default_group_ids
if group_ids: if group_ids:
user.groups.add(group_ids) user.groups.add(*group_ids)
inform_changed_data(user) # put the new user into the cache inform_changed_data(user) # put the new user into the cache
else: else:
logger.info( logger.info(