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
f7371b7f
Commit
f7371b7f
authored
1 year ago
by
Pavel Břoušek
Browse files
Options
Downloads
Plain Diff
chore: merge branch 'peterbolha/
PRX-371
/fix_sync_script' into 'main'
fix: user token types calculation logic Closes
PRX-371
See merge request
!60
parents
532f8d6d
669e2bb5
No related branches found
No related tags found
1 merge request
!60
fix: user token types calculation logic
Pipeline
#393174
passed
1 year ago
Stage: .pre
Stage: test
Stage: deploy
Changes
1
Pipelines
1
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 @
f7371b7f
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.
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