-
Notifications
You must be signed in to change notification settings - Fork 0
/
createAllBankEntitlementsForCurrentUser.py
63 lines (54 loc) · 1.75 KB
/
createAllBankEntitlementsForCurrentUser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from obp_python.getAllRoles import getAllRoles
from obp_python.addRole import addRole
from obp_python.getCurrentUser import getCurrentUser
from json import loads
needed_system_entitlement = 'CanCreateBank'
needed_bank_entitlements = [
'CanCreateCustomer',
'CanUpdateCustomerNumber',
'CanGetCustomers',
'CanCreateCustomerAttributeAtOneBank',
'CanDeleteCustomerCascade',
'CanCreateEntitlementAtOneBank',
'CanCreateBankAttribute',
'CanCreateProductAttribute',
'CanCreateBankLevelDynamicEntity',
'CanDeleteBankCascade',
'CanCreateProduct',
'CanCreateBranch',
'CanDeleteBranch',
'CanCreateAccount',
'CanCreateHistoricalTransactionAtBank',
'CanCreateSettlementAccountAtOneBank',
'CanCreateAccountAttributeAtOneBank',
'CanDeleteAccountCascade',
'CanUseAccountFirehose',
]
def create_bank_entitlements_for_user(bank_id):
user_id = getCurrentUser().json()["user_id"]
for role in needed_bank_entitlements:
try:
addRole(role, bank_id, user_id)
except:
print("did not work")
def create_all_bank_entitlements_for_user(bank_id):
user_id = getCurrentUser().json()["user_id"]
all_roles = loads(getAllRoles().text)["roles"]
all_bank_role_names = [x["role"] for x in all_roles if x["requires_bank_id"]]
for role in all_bank_role_names:
try:
addRole(role, bank_id, user_id)
except:
print("did not work")
def create_authority_data_request_roles(bank_id):
authority_data_request_roles = [
'CanCreateDynamicEntity_authority_data_request',
'CanGetDynamicEntity_authority_data_request',
'CanDeleteDynamicEntity_authority_data_request'
]
for role in authority_data_request_roles:
try:
user_id = getCurrentUser().json()["user_id"]
addRole(role, bank_id, user_id)
except Exception as e:
print(f"could not create auth data request roles: {e}")