Skip to content

Commit 57fccf2

Browse files
committed
implement new account_admin_group config option
1 parent 89252dd commit 57fccf2

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

examples/sign/sign-sync-config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ user_sync:
2828
# The cache will refresh after 24 hours
2929
cache:
3030
path: cache/sign
31+
32+
account_admin_groups:
33+
- Sign Admins 1
34+
- Sign Admins 2
3135

3236
# User management group/role mappings
3337
user_management:
@@ -37,13 +41,11 @@ user_management:
3741
- directory_group: Sign Users 1
3842
sign_group: Group 1
3943
group_admin: False
40-
account_admin: False
4144

4245
# Example 2 - group admin assignment
4346
- directory_group: Sign Group Admins 1
4447
sign_group: primary::Group 2
4548
group_admin: True
46-
account_admin: False
4749

4850
# Example 3 - account admin assignment
4951
# - directory_group: Sign Admins

tests/fixture/sign-sync-config.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ connection:
3232
# Timeout for requests in seconds
3333
timeout: 120
3434

35+
account_admin_groups:
36+
- Sign Admins 1
37+
- Sign Admins 2
38+
3539
# User management group/role mappings
3640
user_management:
3741
# sign_group format: sign_org_name::Sign Group Name, default is 'primary'
@@ -40,25 +44,11 @@ user_management:
4044
- directory_group: Sign Users 1
4145
sign_group: Group 1
4246
group_admin:
43-
account_admin:
4447
# Example 2 - group admin assignment
4548
- directory_group: Sign Group Admins 1
4649
sign_group: primary::Group 2
4750
group_admin: True
48-
account_admin: False
4951

50-
# Example 3 - account admin assignment
51-
# - directory_group: Sign Admins
52-
# sign_group: secondary::Group 3
53-
# admin_role:
54-
# - ACCOUNT_ADMIN
55-
# Example 4 - create user if `create_users` is `True`, otherwise do nothing
56-
# - directory_group: Sign Normal Users
57-
# sign_group: tertiary::Group 4
58-
# admin_role:
59-
# - ACCOUNT_ADMIN
60-
# - GROUP_ADMIN
61-
6252
# Logging options
6353
logging:
6454
log_to_file: True

user_sync/config/sign_sync.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def config_schema() -> Schema:
4040
Optional('group_admin', default=False): Or(bool, None),
4141
Optional('account_admin', default=False): Or(bool, None)
4242
}],
43+
Optional('account_admin_groups'): list,
4344
'cache': {
4445
'path': And(str, len),
4546
},
@@ -187,11 +188,21 @@ def load_directory_groups(self) -> Dict[str, AdobeGroup]:
187188

188189
def load_account_admin_groups(self):
189190
account_admin_groups = set()
191+
using_deprecated_config = False
190192
group_config = self.main_config.get_list_config('user_management', True)
191193
for mapping in group_config.iter_dict_configs():
192194
dir_group = mapping.get_string('directory_group')
193-
if mapping.get_bool('account_admin', True):
195+
is_admin = mapping.get_bool('account_admin', True)
196+
if is_admin is not None:
197+
using_deprecated_config = True
198+
if is_admin:
194199
account_admin_groups.add(dir_group)
200+
if using_deprecated_config:
201+
self.logger.warn("Deprecation warning: using 'account_admin' flag inside of group mapping is deprecated")
202+
admin_cfg_groups = self.main_config.get_list('account_admin_groups', True)
203+
if admin_cfg_groups is not None:
204+
for group in admin_cfg_groups:
205+
account_admin_groups.add(group)
195206
return list(account_admin_groups)
196207

197208
def load_group_admin_mappings(self):

0 commit comments

Comments
 (0)