login_radius 11.0.0 → 11.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +58 -58
- data/lib/login_radius/api/account/account_api.rb +581 -581
- data/lib/login_radius/api/account/role_api.rb +330 -330
- data/lib/login_radius/api/account/sott_api.rb +47 -47
- data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
- data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
- data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
- data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
- data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
- data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
- data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
- data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
- data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
- data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
- data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
- data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
- data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
- data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
- data/lib/login_radius/api/social/native_social_api.rb +255 -255
- data/lib/login_radius/api/social/social_api.rb +784 -806
- data/lib/login_radius/error.rb +7 -7
- data/lib/login_radius/request_client.rb +311 -295
- data/lib/login_radius/response.rb +18 -12
- data/lib/login_radius/version.rb +2 -2
- data/lib/login_radius.rb +30 -30
- data/login_radius.gemspec +25 -28
- metadata +7 -7
@@ -1,330 +1,330 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created by LoginRadius Development Team
|
4
|
-
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
-
require_relative '../../request_client'
|
6
|
-
|
7
|
-
module LoginRadius
|
8
|
-
# RoleApi module
|
9
|
-
class RoleApi
|
10
|
-
include RequestClient
|
11
|
-
|
12
|
-
attr_accessor :site_name, :api_key, :api_secret
|
13
|
-
|
14
|
-
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
-
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
-
def initialize
|
17
|
-
@site_name = ENV['SITE_NAME']
|
18
|
-
@api_key = ENV['API_KEY']
|
19
|
-
@api_secret = ENV['API_SECRET']
|
20
|
-
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
-
unless @site_name != '' && @site_name != nil
|
22
|
-
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
-
unless @api_key != '' && @api_key != nil
|
24
|
-
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
-
unless @api_secret != '' && @api_secret != nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# API is used to retrieve all the assigned roles of a particular User.
|
29
|
-
#
|
30
|
-
# @param uid - UID, the unified identifier for each user account
|
31
|
-
#
|
32
|
-
# @return Response containing Definition of Complete Roles data
|
33
|
-
# 18.6
|
34
|
-
def get_roles_by_uid(uid)
|
35
|
-
if isNullOrWhiteSpace(uid)
|
36
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
37
|
-
end
|
38
|
-
|
39
|
-
query_parameters = {}
|
40
|
-
query_parameters['apiKey'] = @api_key
|
41
|
-
query_parameters['apiSecret'] = @api_secret
|
42
|
-
|
43
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
44
|
-
get_request(resource_path, query_parameters,
|
45
|
-
end
|
46
|
-
|
47
|
-
# This API is used to assign your desired roles to a given user.
|
48
|
-
#
|
49
|
-
# @param account_roles_model - Model Class containing Definition of payload for Create Role API
|
50
|
-
# @param uid - UID, the unified identifier for each user account
|
51
|
-
#
|
52
|
-
# @return Response containing Definition of Complete Roles data
|
53
|
-
# 18.7
|
54
|
-
def assign_roles_by_uid(account_roles_model, uid)
|
55
|
-
if account_roles_model.blank?
|
56
|
-
raise LoginRadius::Error.new, getValidationMessage('account_roles_model')
|
57
|
-
end
|
58
|
-
if isNullOrWhiteSpace(uid)
|
59
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
60
|
-
end
|
61
|
-
|
62
|
-
query_parameters = {}
|
63
|
-
query_parameters['apiKey'] = @api_key
|
64
|
-
query_parameters['apiSecret'] = @api_secret
|
65
|
-
|
66
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
67
|
-
put_request(resource_path, query_parameters, account_roles_model)
|
68
|
-
end
|
69
|
-
|
70
|
-
# This API is used to unassign roles from a user.
|
71
|
-
#
|
72
|
-
# @param account_roles_model - Model Class containing Definition of payload for Create Role API
|
73
|
-
# @param uid - UID, the unified identifier for each user account
|
74
|
-
#
|
75
|
-
# @return Response containing Definition of Delete Request
|
76
|
-
# 18.8
|
77
|
-
def unassign_roles_by_uid(account_roles_model, uid)
|
78
|
-
if account_roles_model.blank?
|
79
|
-
raise LoginRadius::Error.new, getValidationMessage('account_roles_model')
|
80
|
-
end
|
81
|
-
if isNullOrWhiteSpace(uid)
|
82
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
83
|
-
end
|
84
|
-
|
85
|
-
query_parameters = {}
|
86
|
-
query_parameters['apiKey'] = @api_key
|
87
|
-
query_parameters['apiSecret'] = @api_secret
|
88
|
-
|
89
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
90
|
-
delete_request(resource_path, query_parameters, account_roles_model)
|
91
|
-
end
|
92
|
-
|
93
|
-
# This API Gets the contexts that have been configured and the associated roles and permissions.
|
94
|
-
#
|
95
|
-
# @param uid - UID, the unified identifier for each user account
|
96
|
-
#
|
97
|
-
# @return Complete user RoleContext data
|
98
|
-
# 18.9
|
99
|
-
def get_role_context_by_uid(uid)
|
100
|
-
if isNullOrWhiteSpace(uid)
|
101
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
102
|
-
end
|
103
|
-
|
104
|
-
query_parameters = {}
|
105
|
-
query_parameters['apiKey'] = @api_key
|
106
|
-
query_parameters['apiSecret'] = @api_secret
|
107
|
-
|
108
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext'
|
109
|
-
get_request(resource_path, query_parameters,
|
110
|
-
end
|
111
|
-
|
112
|
-
# The API is used to retrieve role context by the context name.
|
113
|
-
#
|
114
|
-
# @param context_name - Name of context
|
115
|
-
#
|
116
|
-
# @return Complete user RoleContext data
|
117
|
-
# 18.10
|
118
|
-
def get_role_context_by_context_name(context_name)
|
119
|
-
if isNullOrWhiteSpace(context_name)
|
120
|
-
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
121
|
-
end
|
122
|
-
|
123
|
-
query_parameters = {}
|
124
|
-
query_parameters['apiKey'] = @api_key
|
125
|
-
query_parameters['apiSecret'] = @api_secret
|
126
|
-
|
127
|
-
resource_path = 'identity/v2/manage/account/rolecontext/' + context_name
|
128
|
-
get_request(resource_path, query_parameters,
|
129
|
-
end
|
130
|
-
|
131
|
-
# This API creates a Context with a set of Roles
|
132
|
-
#
|
133
|
-
# @param account_role_context_model - Model Class containing Definition of RoleContext payload
|
134
|
-
# @param uid - UID, the unified identifier for each user account
|
135
|
-
#
|
136
|
-
# @return Complete user RoleContext data
|
137
|
-
# 18.11
|
138
|
-
def update_role_context_by_uid(account_role_context_model, uid)
|
139
|
-
if account_role_context_model.blank?
|
140
|
-
raise LoginRadius::Error.new, getValidationMessage('account_role_context_model')
|
141
|
-
end
|
142
|
-
if isNullOrWhiteSpace(uid)
|
143
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
144
|
-
end
|
145
|
-
|
146
|
-
query_parameters = {}
|
147
|
-
query_parameters['apiKey'] = @api_key
|
148
|
-
query_parameters['apiSecret'] = @api_secret
|
149
|
-
|
150
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext'
|
151
|
-
put_request(resource_path, query_parameters, account_role_context_model)
|
152
|
-
end
|
153
|
-
|
154
|
-
# This API Deletes the specified Role Context
|
155
|
-
#
|
156
|
-
# @param context_name - Name of context
|
157
|
-
# @param uid - UID, the unified identifier for each user account
|
158
|
-
#
|
159
|
-
# @return Response containing Definition of Delete Request
|
160
|
-
# 18.12
|
161
|
-
def delete_role_context_by_uid(context_name, uid)
|
162
|
-
if isNullOrWhiteSpace(context_name)
|
163
|
-
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
164
|
-
end
|
165
|
-
if isNullOrWhiteSpace(uid)
|
166
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
167
|
-
end
|
168
|
-
|
169
|
-
query_parameters = {}
|
170
|
-
query_parameters['apiKey'] = @api_key
|
171
|
-
query_parameters['apiSecret'] = @api_secret
|
172
|
-
|
173
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name
|
174
|
-
delete_request(resource_path, query_parameters,
|
175
|
-
end
|
176
|
-
|
177
|
-
# This API Deletes the specified Role from a Context.
|
178
|
-
#
|
179
|
-
# @param context_name - Name of context
|
180
|
-
# @param role_context_remove_role_model - Model Class containing Definition of payload for RoleContextRemoveRole API
|
181
|
-
# @param uid - UID, the unified identifier for each user account
|
182
|
-
#
|
183
|
-
# @return Response containing Definition of Delete Request
|
184
|
-
# 18.13
|
185
|
-
def delete_roles_from_role_context_by_uid(context_name, role_context_remove_role_model, uid)
|
186
|
-
if isNullOrWhiteSpace(context_name)
|
187
|
-
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
188
|
-
end
|
189
|
-
if role_context_remove_role_model.blank?
|
190
|
-
raise LoginRadius::Error.new, getValidationMessage('role_context_remove_role_model')
|
191
|
-
end
|
192
|
-
if isNullOrWhiteSpace(uid)
|
193
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
194
|
-
end
|
195
|
-
|
196
|
-
query_parameters = {}
|
197
|
-
query_parameters['apiKey'] = @api_key
|
198
|
-
query_parameters['apiSecret'] = @api_secret
|
199
|
-
|
200
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name + '/role'
|
201
|
-
delete_request(resource_path, query_parameters, role_context_remove_role_model)
|
202
|
-
end
|
203
|
-
|
204
|
-
# This API Deletes Additional Permissions from Context.
|
205
|
-
#
|
206
|
-
# @param context_name - Name of context
|
207
|
-
# @param role_context_additional_permission_remove_role_model - Model Class containing Definition of payload for RoleContextAdditionalPermissionRemoveRole API
|
208
|
-
# @param uid - UID, the unified identifier for each user account
|
209
|
-
#
|
210
|
-
# @return Response containing Definition of Delete Request
|
211
|
-
# 18.14
|
212
|
-
def delete_additional_permission_from_role_context_by_uid(context_name, role_context_additional_permission_remove_role_model, uid)
|
213
|
-
if isNullOrWhiteSpace(context_name)
|
214
|
-
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
215
|
-
end
|
216
|
-
if role_context_additional_permission_remove_role_model.blank?
|
217
|
-
raise LoginRadius::Error.new, getValidationMessage('role_context_additional_permission_remove_role_model')
|
218
|
-
end
|
219
|
-
if isNullOrWhiteSpace(uid)
|
220
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
221
|
-
end
|
222
|
-
|
223
|
-
query_parameters = {}
|
224
|
-
query_parameters['apiKey'] = @api_key
|
225
|
-
query_parameters['apiSecret'] = @api_secret
|
226
|
-
|
227
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name + '/additionalpermission'
|
228
|
-
delete_request(resource_path, query_parameters, role_context_additional_permission_remove_role_model)
|
229
|
-
end
|
230
|
-
|
231
|
-
# This API retrieves the complete list of created roles with permissions of your app.
|
232
|
-
#
|
233
|
-
#
|
234
|
-
# @return Complete user Roles List data
|
235
|
-
# 41.1
|
236
|
-
def get_roles_list()
|
237
|
-
|
238
|
-
query_parameters = {}
|
239
|
-
query_parameters['apiKey'] = @api_key
|
240
|
-
query_parameters['apiSecret'] = @api_secret
|
241
|
-
|
242
|
-
resource_path = 'identity/v2/manage/role'
|
243
|
-
get_request(resource_path, query_parameters,
|
244
|
-
end
|
245
|
-
|
246
|
-
# This API creates a role with permissions.
|
247
|
-
#
|
248
|
-
# @param roles_model - Model Class containing Definition of payload for Roles API
|
249
|
-
#
|
250
|
-
# @return Complete user Roles data
|
251
|
-
# 41.2
|
252
|
-
def create_roles(roles_model)
|
253
|
-
if roles_model.blank?
|
254
|
-
raise LoginRadius::Error.new, getValidationMessage('roles_model')
|
255
|
-
end
|
256
|
-
|
257
|
-
query_parameters = {}
|
258
|
-
query_parameters['apiKey'] = @api_key
|
259
|
-
query_parameters['apiSecret'] = @api_secret
|
260
|
-
|
261
|
-
resource_path = 'identity/v2/manage/role'
|
262
|
-
post_request(resource_path, query_parameters, roles_model)
|
263
|
-
end
|
264
|
-
|
265
|
-
# This API is used to delete the role.
|
266
|
-
#
|
267
|
-
# @param role - Created RoleName
|
268
|
-
#
|
269
|
-
# @return Response containing Definition of Delete Request
|
270
|
-
# 41.3
|
271
|
-
def delete_role(role)
|
272
|
-
if isNullOrWhiteSpace(role)
|
273
|
-
raise LoginRadius::Error.new, getValidationMessage('role')
|
274
|
-
end
|
275
|
-
|
276
|
-
query_parameters = {}
|
277
|
-
query_parameters['apiKey'] = @api_key
|
278
|
-
query_parameters['apiSecret'] = @api_secret
|
279
|
-
|
280
|
-
resource_path = 'identity/v2/manage/role/' + role
|
281
|
-
delete_request(resource_path, query_parameters,
|
282
|
-
end
|
283
|
-
|
284
|
-
# This API is used to add permissions to a given role.
|
285
|
-
#
|
286
|
-
# @param permissions_model - Model Class containing Definition for PermissionsModel Property
|
287
|
-
# @param role - Created RoleName
|
288
|
-
#
|
289
|
-
# @return Response containing Definition of Complete role data
|
290
|
-
# 41.4
|
291
|
-
def add_role_permissions(permissions_model, role)
|
292
|
-
if permissions_model.blank?
|
293
|
-
raise LoginRadius::Error.new, getValidationMessage('permissions_model')
|
294
|
-
end
|
295
|
-
if isNullOrWhiteSpace(role)
|
296
|
-
raise LoginRadius::Error.new, getValidationMessage('role')
|
297
|
-
end
|
298
|
-
|
299
|
-
query_parameters = {}
|
300
|
-
query_parameters['apiKey'] = @api_key
|
301
|
-
query_parameters['apiSecret'] = @api_secret
|
302
|
-
|
303
|
-
resource_path = 'identity/v2/manage/role/' + role + '/permission'
|
304
|
-
put_request(resource_path, query_parameters, permissions_model)
|
305
|
-
end
|
306
|
-
|
307
|
-
# API is used to remove permissions from a role.
|
308
|
-
#
|
309
|
-
# @param permissions_model - Model Class containing Definition for PermissionsModel Property
|
310
|
-
# @param role - Created RoleName
|
311
|
-
#
|
312
|
-
# @return Response containing Definition of Complete role data
|
313
|
-
# 41.5
|
314
|
-
def remove_role_permissions(permissions_model, role)
|
315
|
-
if permissions_model.blank?
|
316
|
-
raise LoginRadius::Error.new, getValidationMessage('permissions_model')
|
317
|
-
end
|
318
|
-
if isNullOrWhiteSpace(role)
|
319
|
-
raise LoginRadius::Error.new, getValidationMessage('role')
|
320
|
-
end
|
321
|
-
|
322
|
-
query_parameters = {}
|
323
|
-
query_parameters['apiKey'] = @api_key
|
324
|
-
query_parameters['apiSecret'] = @api_secret
|
325
|
-
|
326
|
-
resource_path = 'identity/v2/manage/role/' + role + '/permission'
|
327
|
-
delete_request(resource_path, query_parameters, permissions_model)
|
328
|
-
end
|
329
|
-
end
|
330
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Created by LoginRadius Development Team
|
4
|
+
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
+
require_relative '../../request_client'
|
6
|
+
|
7
|
+
module LoginRadius
|
8
|
+
# RoleApi module
|
9
|
+
class RoleApi
|
10
|
+
include RequestClient
|
11
|
+
|
12
|
+
attr_accessor :site_name, :api_key, :api_secret
|
13
|
+
|
14
|
+
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
+
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
+
def initialize
|
17
|
+
@site_name = ENV['SITE_NAME']
|
18
|
+
@api_key = ENV['API_KEY']
|
19
|
+
@api_secret = ENV['API_SECRET']
|
20
|
+
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
+
unless @site_name != '' && @site_name != nil
|
22
|
+
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
+
unless @api_key != '' && @api_key != nil
|
24
|
+
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
+
unless @api_secret != '' && @api_secret != nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# API is used to retrieve all the assigned roles of a particular User.
|
29
|
+
#
|
30
|
+
# @param uid - UID, the unified identifier for each user account
|
31
|
+
#
|
32
|
+
# @return Response containing Definition of Complete Roles data
|
33
|
+
# 18.6
|
34
|
+
def get_roles_by_uid(uid)
|
35
|
+
if isNullOrWhiteSpace(uid)
|
36
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
37
|
+
end
|
38
|
+
|
39
|
+
query_parameters = {}
|
40
|
+
query_parameters['apiKey'] = @api_key
|
41
|
+
query_parameters['apiSecret'] = @api_secret
|
42
|
+
|
43
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
44
|
+
get_request(resource_path, query_parameters, {})
|
45
|
+
end
|
46
|
+
|
47
|
+
# This API is used to assign your desired roles to a given user.
|
48
|
+
#
|
49
|
+
# @param account_roles_model - Model Class containing Definition of payload for Create Role API
|
50
|
+
# @param uid - UID, the unified identifier for each user account
|
51
|
+
#
|
52
|
+
# @return Response containing Definition of Complete Roles data
|
53
|
+
# 18.7
|
54
|
+
def assign_roles_by_uid(account_roles_model, uid)
|
55
|
+
if account_roles_model.blank?
|
56
|
+
raise LoginRadius::Error.new, getValidationMessage('account_roles_model')
|
57
|
+
end
|
58
|
+
if isNullOrWhiteSpace(uid)
|
59
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
60
|
+
end
|
61
|
+
|
62
|
+
query_parameters = {}
|
63
|
+
query_parameters['apiKey'] = @api_key
|
64
|
+
query_parameters['apiSecret'] = @api_secret
|
65
|
+
|
66
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
67
|
+
put_request(resource_path, query_parameters, account_roles_model)
|
68
|
+
end
|
69
|
+
|
70
|
+
# This API is used to unassign roles from a user.
|
71
|
+
#
|
72
|
+
# @param account_roles_model - Model Class containing Definition of payload for Create Role API
|
73
|
+
# @param uid - UID, the unified identifier for each user account
|
74
|
+
#
|
75
|
+
# @return Response containing Definition of Delete Request
|
76
|
+
# 18.8
|
77
|
+
def unassign_roles_by_uid(account_roles_model, uid)
|
78
|
+
if account_roles_model.blank?
|
79
|
+
raise LoginRadius::Error.new, getValidationMessage('account_roles_model')
|
80
|
+
end
|
81
|
+
if isNullOrWhiteSpace(uid)
|
82
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
83
|
+
end
|
84
|
+
|
85
|
+
query_parameters = {}
|
86
|
+
query_parameters['apiKey'] = @api_key
|
87
|
+
query_parameters['apiSecret'] = @api_secret
|
88
|
+
|
89
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/role'
|
90
|
+
delete_request(resource_path, query_parameters, account_roles_model)
|
91
|
+
end
|
92
|
+
|
93
|
+
# This API Gets the contexts that have been configured and the associated roles and permissions.
|
94
|
+
#
|
95
|
+
# @param uid - UID, the unified identifier for each user account
|
96
|
+
#
|
97
|
+
# @return Complete user RoleContext data
|
98
|
+
# 18.9
|
99
|
+
def get_role_context_by_uid(uid)
|
100
|
+
if isNullOrWhiteSpace(uid)
|
101
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
102
|
+
end
|
103
|
+
|
104
|
+
query_parameters = {}
|
105
|
+
query_parameters['apiKey'] = @api_key
|
106
|
+
query_parameters['apiSecret'] = @api_secret
|
107
|
+
|
108
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext'
|
109
|
+
get_request(resource_path, query_parameters, {})
|
110
|
+
end
|
111
|
+
|
112
|
+
# The API is used to retrieve role context by the context name.
|
113
|
+
#
|
114
|
+
# @param context_name - Name of context
|
115
|
+
#
|
116
|
+
# @return Complete user RoleContext data
|
117
|
+
# 18.10
|
118
|
+
def get_role_context_by_context_name(context_name)
|
119
|
+
if isNullOrWhiteSpace(context_name)
|
120
|
+
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
121
|
+
end
|
122
|
+
|
123
|
+
query_parameters = {}
|
124
|
+
query_parameters['apiKey'] = @api_key
|
125
|
+
query_parameters['apiSecret'] = @api_secret
|
126
|
+
|
127
|
+
resource_path = 'identity/v2/manage/account/rolecontext/' + context_name
|
128
|
+
get_request(resource_path, query_parameters, {})
|
129
|
+
end
|
130
|
+
|
131
|
+
# This API creates a Context with a set of Roles
|
132
|
+
#
|
133
|
+
# @param account_role_context_model - Model Class containing Definition of RoleContext payload
|
134
|
+
# @param uid - UID, the unified identifier for each user account
|
135
|
+
#
|
136
|
+
# @return Complete user RoleContext data
|
137
|
+
# 18.11
|
138
|
+
def update_role_context_by_uid(account_role_context_model, uid)
|
139
|
+
if account_role_context_model.blank?
|
140
|
+
raise LoginRadius::Error.new, getValidationMessage('account_role_context_model')
|
141
|
+
end
|
142
|
+
if isNullOrWhiteSpace(uid)
|
143
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
144
|
+
end
|
145
|
+
|
146
|
+
query_parameters = {}
|
147
|
+
query_parameters['apiKey'] = @api_key
|
148
|
+
query_parameters['apiSecret'] = @api_secret
|
149
|
+
|
150
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext'
|
151
|
+
put_request(resource_path, query_parameters, account_role_context_model)
|
152
|
+
end
|
153
|
+
|
154
|
+
# This API Deletes the specified Role Context
|
155
|
+
#
|
156
|
+
# @param context_name - Name of context
|
157
|
+
# @param uid - UID, the unified identifier for each user account
|
158
|
+
#
|
159
|
+
# @return Response containing Definition of Delete Request
|
160
|
+
# 18.12
|
161
|
+
def delete_role_context_by_uid(context_name, uid)
|
162
|
+
if isNullOrWhiteSpace(context_name)
|
163
|
+
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
164
|
+
end
|
165
|
+
if isNullOrWhiteSpace(uid)
|
166
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
167
|
+
end
|
168
|
+
|
169
|
+
query_parameters = {}
|
170
|
+
query_parameters['apiKey'] = @api_key
|
171
|
+
query_parameters['apiSecret'] = @api_secret
|
172
|
+
|
173
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name
|
174
|
+
delete_request(resource_path, query_parameters, {})
|
175
|
+
end
|
176
|
+
|
177
|
+
# This API Deletes the specified Role from a Context.
|
178
|
+
#
|
179
|
+
# @param context_name - Name of context
|
180
|
+
# @param role_context_remove_role_model - Model Class containing Definition of payload for RoleContextRemoveRole API
|
181
|
+
# @param uid - UID, the unified identifier for each user account
|
182
|
+
#
|
183
|
+
# @return Response containing Definition of Delete Request
|
184
|
+
# 18.13
|
185
|
+
def delete_roles_from_role_context_by_uid(context_name, role_context_remove_role_model, uid)
|
186
|
+
if isNullOrWhiteSpace(context_name)
|
187
|
+
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
188
|
+
end
|
189
|
+
if role_context_remove_role_model.blank?
|
190
|
+
raise LoginRadius::Error.new, getValidationMessage('role_context_remove_role_model')
|
191
|
+
end
|
192
|
+
if isNullOrWhiteSpace(uid)
|
193
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
194
|
+
end
|
195
|
+
|
196
|
+
query_parameters = {}
|
197
|
+
query_parameters['apiKey'] = @api_key
|
198
|
+
query_parameters['apiSecret'] = @api_secret
|
199
|
+
|
200
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name + '/role'
|
201
|
+
delete_request(resource_path, query_parameters, role_context_remove_role_model)
|
202
|
+
end
|
203
|
+
|
204
|
+
# This API Deletes Additional Permissions from Context.
|
205
|
+
#
|
206
|
+
# @param context_name - Name of context
|
207
|
+
# @param role_context_additional_permission_remove_role_model - Model Class containing Definition of payload for RoleContextAdditionalPermissionRemoveRole API
|
208
|
+
# @param uid - UID, the unified identifier for each user account
|
209
|
+
#
|
210
|
+
# @return Response containing Definition of Delete Request
|
211
|
+
# 18.14
|
212
|
+
def delete_additional_permission_from_role_context_by_uid(context_name, role_context_additional_permission_remove_role_model, uid)
|
213
|
+
if isNullOrWhiteSpace(context_name)
|
214
|
+
raise LoginRadius::Error.new, getValidationMessage('context_name')
|
215
|
+
end
|
216
|
+
if role_context_additional_permission_remove_role_model.blank?
|
217
|
+
raise LoginRadius::Error.new, getValidationMessage('role_context_additional_permission_remove_role_model')
|
218
|
+
end
|
219
|
+
if isNullOrWhiteSpace(uid)
|
220
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
221
|
+
end
|
222
|
+
|
223
|
+
query_parameters = {}
|
224
|
+
query_parameters['apiKey'] = @api_key
|
225
|
+
query_parameters['apiSecret'] = @api_secret
|
226
|
+
|
227
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/rolecontext/' + context_name + '/additionalpermission'
|
228
|
+
delete_request(resource_path, query_parameters, role_context_additional_permission_remove_role_model)
|
229
|
+
end
|
230
|
+
|
231
|
+
# This API retrieves the complete list of created roles with permissions of your app.
|
232
|
+
#
|
233
|
+
#
|
234
|
+
# @return Complete user Roles List data
|
235
|
+
# 41.1
|
236
|
+
def get_roles_list()
|
237
|
+
|
238
|
+
query_parameters = {}
|
239
|
+
query_parameters['apiKey'] = @api_key
|
240
|
+
query_parameters['apiSecret'] = @api_secret
|
241
|
+
|
242
|
+
resource_path = 'identity/v2/manage/role'
|
243
|
+
get_request(resource_path, query_parameters, {})
|
244
|
+
end
|
245
|
+
|
246
|
+
# This API creates a role with permissions.
|
247
|
+
#
|
248
|
+
# @param roles_model - Model Class containing Definition of payload for Roles API
|
249
|
+
#
|
250
|
+
# @return Complete user Roles data
|
251
|
+
# 41.2
|
252
|
+
def create_roles(roles_model)
|
253
|
+
if roles_model.blank?
|
254
|
+
raise LoginRadius::Error.new, getValidationMessage('roles_model')
|
255
|
+
end
|
256
|
+
|
257
|
+
query_parameters = {}
|
258
|
+
query_parameters['apiKey'] = @api_key
|
259
|
+
query_parameters['apiSecret'] = @api_secret
|
260
|
+
|
261
|
+
resource_path = 'identity/v2/manage/role'
|
262
|
+
post_request(resource_path, query_parameters, roles_model)
|
263
|
+
end
|
264
|
+
|
265
|
+
# This API is used to delete the role.
|
266
|
+
#
|
267
|
+
# @param role - Created RoleName
|
268
|
+
#
|
269
|
+
# @return Response containing Definition of Delete Request
|
270
|
+
# 41.3
|
271
|
+
def delete_role(role)
|
272
|
+
if isNullOrWhiteSpace(role)
|
273
|
+
raise LoginRadius::Error.new, getValidationMessage('role')
|
274
|
+
end
|
275
|
+
|
276
|
+
query_parameters = {}
|
277
|
+
query_parameters['apiKey'] = @api_key
|
278
|
+
query_parameters['apiSecret'] = @api_secret
|
279
|
+
|
280
|
+
resource_path = 'identity/v2/manage/role/' + role
|
281
|
+
delete_request(resource_path, query_parameters, {})
|
282
|
+
end
|
283
|
+
|
284
|
+
# This API is used to add permissions to a given role.
|
285
|
+
#
|
286
|
+
# @param permissions_model - Model Class containing Definition for PermissionsModel Property
|
287
|
+
# @param role - Created RoleName
|
288
|
+
#
|
289
|
+
# @return Response containing Definition of Complete role data
|
290
|
+
# 41.4
|
291
|
+
def add_role_permissions(permissions_model, role)
|
292
|
+
if permissions_model.blank?
|
293
|
+
raise LoginRadius::Error.new, getValidationMessage('permissions_model')
|
294
|
+
end
|
295
|
+
if isNullOrWhiteSpace(role)
|
296
|
+
raise LoginRadius::Error.new, getValidationMessage('role')
|
297
|
+
end
|
298
|
+
|
299
|
+
query_parameters = {}
|
300
|
+
query_parameters['apiKey'] = @api_key
|
301
|
+
query_parameters['apiSecret'] = @api_secret
|
302
|
+
|
303
|
+
resource_path = 'identity/v2/manage/role/' + role + '/permission'
|
304
|
+
put_request(resource_path, query_parameters, permissions_model)
|
305
|
+
end
|
306
|
+
|
307
|
+
# API is used to remove permissions from a role.
|
308
|
+
#
|
309
|
+
# @param permissions_model - Model Class containing Definition for PermissionsModel Property
|
310
|
+
# @param role - Created RoleName
|
311
|
+
#
|
312
|
+
# @return Response containing Definition of Complete role data
|
313
|
+
# 41.5
|
314
|
+
def remove_role_permissions(permissions_model, role)
|
315
|
+
if permissions_model.blank?
|
316
|
+
raise LoginRadius::Error.new, getValidationMessage('permissions_model')
|
317
|
+
end
|
318
|
+
if isNullOrWhiteSpace(role)
|
319
|
+
raise LoginRadius::Error.new, getValidationMessage('role')
|
320
|
+
end
|
321
|
+
|
322
|
+
query_parameters = {}
|
323
|
+
query_parameters['apiKey'] = @api_key
|
324
|
+
query_parameters['apiSecret'] = @api_secret
|
325
|
+
|
326
|
+
resource_path = 'identity/v2/manage/role/' + role + '/permission'
|
327
|
+
delete_request(resource_path, query_parameters, permissions_model)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|