Skip to content

Commit

Permalink
Merge pull request #107 from serlo/check-for-vidis-role-on-login
Browse files Browse the repository at this point in the history
feat: check for vidis role on login
  • Loading branch information
hugotiburtino authored Jul 25, 2024
2 parents a01815a + 886744a commit b18186c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/kratos/vidis_user_mapper.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ local buildUsername = function()
then preferredUsername + '-' + enshortenUuid(uuid)
else enshortenUuid(uuid);

{
local checkIfIsTeacher = function()
local rawClaims = extractFromClaims('raw_claims');

if 'rolle' in rawClaims then rawClaims['rolle'] == 'LEHR' else false;

if checkIfIsTeacher() then {
identity: {
traits: {
email: buildEmail(),
username: buildUsername(),
interest: 'other',
},
},
}
} else error "ERR_BAD_ROLE"

0 comments on commit b18186c

Please sign in to comment.