Class: OryClient::PermissionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ory-client/api/permission_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PermissionApi

Returns a new instance of PermissionApi.



19
20
21
# File 'lib/ory-client/api/permission_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ory-client/api/permission_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#batch_check_permission(opts = {}) ⇒ BatchCheckPermissionResult

Batch check permissions To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



28
29
30
31
# File 'lib/ory-client/api/permission_api.rb', line 28

def batch_check_permission(opts = {})
  data, _status_code, _headers = batch_check_permission_with_http_info(opts)
  data
end

#batch_check_permission_with_http_info(opts = {}) ⇒ Array<(BatchCheckPermissionResult, Integer, Hash)>

Batch check permissions To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(BatchCheckPermissionResult, Integer, Hash)>)

    BatchCheckPermissionResult data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ory-client/api/permission_api.rb', line 39

def batch_check_permission_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.batch_check_permission ...'
  end
  # resource path
  local_var_path = '/relation-tuples/batch/check'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'batch_check_permission_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'BatchCheckPermissionResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.batch_check_permission",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#batch_check_permission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#check_permission(opts = {}) ⇒ CheckPermissionResult

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relationship

  • :object (String)

    Object of the Relationship

  • :relation (String)

    Relation of the Relationship

  • :subject_id (String)

    SubjectID of the Relationship

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:



101
102
103
104
# File 'lib/ory-client/api/permission_api.rb', line 101

def check_permission(opts = {})
  data, _status_code, _headers = check_permission_with_http_info(opts)
  data
end

#check_permission_or_error(opts = {}) ⇒ CheckPermissionResult

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relationship

  • :object (String)

    Object of the Relationship

  • :relation (String)

    Relation of the Relationship

  • :subject_id (String)

    SubjectID of the Relationship

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:



182
183
184
185
# File 'lib/ory-client/api/permission_api.rb', line 182

def check_permission_or_error(opts = {})
  data, _status_code, _headers = check_permission_or_error_with_http_info(opts)
  data
end

#check_permission_or_error_with_http_info(opts = {}) ⇒ Array<(CheckPermissionResult, Integer, Hash)>

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relationship

  • :object (String)

    Object of the Relationship

  • :relation (String)

    Relation of the Relationship

  • :subject_id (String)

    SubjectID of the Relationship

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:

  • (Array<(CheckPermissionResult, Integer, Hash)>)

    CheckPermissionResult data, response status code and response headers



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/ory-client/api/permission_api.rb', line 199

def check_permission_or_error_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.check_permission_or_error ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'namespace'] = opts[:'namespace'] if !opts[:'namespace'].nil?
  query_params[:'object'] = opts[:'object'] if !opts[:'object'].nil?
  query_params[:'relation'] = opts[:'relation'] if !opts[:'relation'].nil?
  query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil?
  query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil?
  query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil?
  query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil?
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CheckPermissionResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.check_permission_or_error",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#check_permission_or_error\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#check_permission_with_http_info(opts = {}) ⇒ Array<(CheckPermissionResult, Integer, Hash)>

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relationship

  • :object (String)

    Object of the Relationship

  • :relation (String)

    Relation of the Relationship

  • :subject_id (String)

    SubjectID of the Relationship

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:

  • (Array<(CheckPermissionResult, Integer, Hash)>)

    CheckPermissionResult data, response status code and response headers



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/ory-client/api/permission_api.rb', line 118

def check_permission_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.check_permission ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check/openapi'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'namespace'] = opts[:'namespace'] if !opts[:'namespace'].nil?
  query_params[:'object'] = opts[:'object'] if !opts[:'object'].nil?
  query_params[:'relation'] = opts[:'relation'] if !opts[:'relation'].nil?
  query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil?
  query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil?
  query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil?
  query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil?
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CheckPermissionResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.check_permission",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#check_permission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#expand_permissions(namespace, object, relation, opts = {}) ⇒ ExpandedPermissionTree

Expand a Relationship into permissions. Use this endpoint to expand a relationship tuple into permissions.

Parameters:

  • namespace (String)

    Namespace of the Subject Set

  • object (String)

    Object of the Subject Set

  • relation (String)

    Relation of the Subject Set

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max_depth (Integer)

Returns:



259
260
261
262
# File 'lib/ory-client/api/permission_api.rb', line 259

def expand_permissions(namespace, object, relation, opts = {})
  data, _status_code, _headers = expand_permissions_with_http_info(namespace, object, relation, opts)
  data
end

#expand_permissions_with_http_info(namespace, object, relation, opts = {}) ⇒ Array<(ExpandedPermissionTree, Integer, Hash)>

Expand a Relationship into permissions. Use this endpoint to expand a relationship tuple into permissions.

Parameters:

  • namespace (String)

    Namespace of the Subject Set

  • object (String)

    Object of the Subject Set

  • relation (String)

    Relation of the Subject Set

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max_depth (Integer)

Returns:

  • (Array<(ExpandedPermissionTree, Integer, Hash)>)

    ExpandedPermissionTree data, response status code and response headers



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/ory-client/api/permission_api.rb', line 272

def expand_permissions_with_http_info(namespace, object, relation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.expand_permissions ...'
  end
  # verify the required parameter 'namespace' is set
  if @api_client.config.client_side_validation && namespace.nil?
    fail ArgumentError, "Missing the required parameter 'namespace' when calling PermissionApi.expand_permissions"
  end
  # verify the required parameter 'object' is set
  if @api_client.config.client_side_validation && object.nil?
    fail ArgumentError, "Missing the required parameter 'object' when calling PermissionApi.expand_permissions"
  end
  # verify the required parameter 'relation' is set
  if @api_client.config.client_side_validation && relation.nil?
    fail ArgumentError, "Missing the required parameter 'relation' when calling PermissionApi.expand_permissions"
  end
  # resource path
  local_var_path = '/relation-tuples/expand'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'namespace'] = namespace
  query_params[:'object'] = object
  query_params[:'relation'] = relation
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ExpandedPermissionTree'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.expand_permissions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#expand_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_check_permission(opts = {}) ⇒ CheckPermissionResult

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



338
339
340
341
# File 'lib/ory-client/api/permission_api.rb', line 338

def post_check_permission(opts = {})
  data, _status_code, _headers = post_check_permission_with_http_info(opts)
  data
end

#post_check_permission_or_error(opts = {}) ⇒ CheckPermissionResult

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



405
406
407
408
# File 'lib/ory-client/api/permission_api.rb', line 405

def post_check_permission_or_error(opts = {})
  data, _status_code, _headers = post_check_permission_or_error_with_http_info(opts)
  data
end

#post_check_permission_or_error_with_http_info(opts = {}) ⇒ Array<(CheckPermissionResult, Integer, Hash)>

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(CheckPermissionResult, Integer, Hash)>)

    CheckPermissionResult data, response status code and response headers



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/ory-client/api/permission_api.rb', line 416

def post_check_permission_or_error_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.post_check_permission_or_error ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'post_check_permission_or_error_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'CheckPermissionResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.post_check_permission_or_error",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#post_check_permission_or_error\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_check_permission_with_http_info(opts = {}) ⇒ Array<(CheckPermissionResult, Integer, Hash)>

Check a permission To learn how relationship tuples and the check works, head over to [the documentation](www.ory.sh/docs/keto/concepts/api-overview).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(CheckPermissionResult, Integer, Hash)>)

    CheckPermissionResult data, response status code and response headers



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/ory-client/api/permission_api.rb', line 349

def post_check_permission_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.post_check_permission ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check/openapi'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'post_check_permission_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'CheckPermissionResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"PermissionApi.post_check_permission",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#post_check_permission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end