Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
perun-proxy-utils
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Perun
Perun ProxyIdP
perun-proxy-utils
Commits
669e2bb5
Verified
Commit
669e2bb5
authored
1 year ago
by
Peter Bolha
Browse files
Options
Downloads
Patches
Plain Diff
fix: user token types calculation logic
parent
532f8d6d
No related branches found
No related tags found
1 merge request
!60
fix: user token types calculation logic
Pipeline
#393167
passed
1 year ago
Stage: .pre
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
perun/proxy/utils/sync_usable_token_types.py
+9
-10
9 additions, 10 deletions
perun/proxy/utils/sync_usable_token_types.py
with
9 additions
and
10 deletions
perun/proxy/utils/sync_usable_token_types.py
+
9
−
10
View file @
669e2bb5
import
argparse
import
argparse
import
os
import
os
import
re
import
re
from
collections
import
defaultdict
from
typing
import
List
,
Tuple
,
Optional
,
Pattern
from
typing
import
List
,
Tuple
,
Optional
,
Pattern
import
yaml
import
yaml
...
@@ -128,18 +129,16 @@ def main():
...
@@ -128,18 +129,16 @@ def main():
mfa_active_tokens_attr_name
=
args
.
mfa_active_tokens_attr_name
mfa_active_tokens_attr_name
=
args
.
mfa_active_tokens_attr_name
adapters_manager
=
get_adapters_manager
(
args
.
perun_connector_config_path
)
adapters_manager
=
get_adapters_manager
(
args
.
perun_connector_config_path
)
user_token_types
=
get_user_token_types
()
user_token_types
=
get_user_token_types
()
current_user_id
=
""
user_all_usable_tokens
=
defaultdict
(
list
)
current_user_token_types
=
[]
for
privacyidea_user_id
,
token_type
in
user_token_types
:
for
privacyidea_user_id
,
token_type
in
user_token_types
:
perun_user_id
=
parse_perun_user_id
(
perun_user_id_regex
,
privacyidea_user_id
)
perun_user_id
=
parse_perun_user_id
(
perun_user_id_regex
,
privacyidea_user_id
)
if
perun_user_id
and
perun_user_id
!=
current_user_id
:
user_all_usable_tokens
[
perun_user_id
].
append
(
token_type
)
if
current_user_id
:
current_user_token_types
.
sort
()
for
perun_user_id
,
token_types
in
user_all_usable_tokens
.
items
():
attr_to_set
=
{
mfa_active_tokens_attr_name
:
current_user_token_types
}
token_types
.
sort
()
adapters_manager
.
set_user_attributes
(
int
(
perun_user_id
),
attr_to_set
)
attr_to_set
=
{
mfa_active_tokens_attr_name
:
token_types
}
current_user_id
=
perun_user_id
adapters_manager
.
set_user_attributes
(
int
(
perun_user_id
),
attr_to_set
)
current_user_token_types
=
[]
current_user_token_types
.
append
(
token_type
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
Perun-GitLab Service Account
@9045464
mentioned in commit
961e4e41
·
1 year ago
mentioned in commit
961e4e41
mentioned in commit 961e4e4133b14e78440223ae8e3e0556de3ba2fe
Toggle commit list
Jiří Prokop
@525248
mentioned in commit
e617b984
·
1 year ago
mentioned in commit
e617b984
mentioned in commit e617b9844eb62cd0f7bb62a43645b359a85f2023
Toggle commit list
Jiří Prokop
@525248
mentioned in commit
a28363ce
·
1 year ago
mentioned in commit
a28363ce
mentioned in commit a28363cefed7383ba20da3010538132afdc929b3
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment