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

#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:



34
35
36
37
# File 'lib/ory-client/api/permission_api.rb', line 34

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:



115
116
117
118
# File 'lib/ory-client/api/permission_api.rb', line 115

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



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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/ory-client/api/permission_api.rb', line 132

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'])

  # 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



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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/ory-client/api/permission_api.rb', line 51

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'])

  # 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:



192
193
194
195
# File 'lib/ory-client/api/permission_api.rb', line 192

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



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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/ory-client/api/permission_api.rb', line 205

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'])

  # 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:



271
272
273
274
# File 'lib/ory-client/api/permission_api.rb', line 271

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:



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

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



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_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'])
  # 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



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 282

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'])
  # 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