Class: AuthressSdk::UserPermissionsApi
- Inherits:
-
Object
- Object
- AuthressSdk::UserPermissionsApi
- Defined in:
- lib/authress-sdk/api/user_permissions_api.rb
Instance Attribute Summary collapse
-
#authress_client ⇒ Object
Returns the value of attribute authress_client.
Instance Method Summary collapse
-
#authorize_user(user_id, resource_uri, permission, opts = {}) ⇒ nil
Check to see if a user has permissions to a resource.
-
#authorize_user_with_http_info(user_id, resource_uri, permission, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Check to see if a user has permissions to a resource.
-
#disable_user_token(user_id, token_id, opts = {}) ⇒ nil
Disable a token.
-
#disable_user_token_with_http_info(user_id, token_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Disable a token.
-
#get_user_permissions_for_resource(user_id, resource_uri, opts = {}) ⇒ PermissionCollection
Get the permissions a user has to a resource.
-
#get_user_permissions_for_resource_with_http_info(user_id, resource_uri, opts = {}) ⇒ Array<(PermissionCollection, Integer, Hash)>
Get the permissions a user has to a resource.
-
#get_user_resources(user_id, opts = {}) ⇒ UserResources
Get the resources a user has to permission to.
-
#get_user_resources_with_http_info(user_id, opts = {}) ⇒ Array<(UserResources, Integer, Hash)>
Get the resources a user has to permission to.
-
#initialize(authress_client = AuthressClient.default) ⇒ UserPermissionsApi
constructor
A new instance of UserPermissionsApi.
-
#request_user_token(body, user_id, opts = {}) ⇒ UserToken
Request a user token with additional configuration.
-
#request_user_token_with_http_info(body, user_id, opts = {}) ⇒ Array<(UserToken, Integer, Hash)>
Request a user token with additional configuration.
Constructor Details
#initialize(authress_client = AuthressClient.default) ⇒ UserPermissionsApi
Returns a new instance of UserPermissionsApi.
9 10 11 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 9 def initialize(authress_client = AuthressClient.default) @authress_client = authress_client end |
Instance Attribute Details
#authress_client ⇒ Object
Returns the value of attribute authress_client.
7 8 9 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 7 def authress_client @authress_client end |
Instance Method Details
#authorize_user(user_id, resource_uri, permission, opts = {}) ⇒ nil
Check to see if a user has permissions to a resource. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Does the user have the specified permissions to the resource?
<span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
19 20 21 22 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 19 def (user_id, resource_uri, , opts = {}) (user_id, resource_uri, , opts) nil end |
#authorize_user_with_http_info(user_id, resource_uri, permission, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Check to see if a user has permissions to a resource. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Does the user have the specified permissions to the resource? <br><span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 31 def (user_id, resource_uri, , opts = {}) if @authress_client.config[:debugging] @authress_client.config[:logger].debug 'Calling API: UserPermissionsApi.authorize_user ...' end # verify the required parameter 'user_id' is set if @authress_client.config[:client_side_validation] && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserPermissionsApi.authorize_user" end # verify the required parameter 'resource_uri' is set if @authress_client.config[:client_side_validation] && resource_uri.nil? fail ArgumentError, "Missing the required parameter 'resource_uri' when calling UserPermissionsApi.authorize_user" end # verify the required parameter 'permission' is set if @authress_client.config[:client_side_validation] && .nil? fail ArgumentError, "Missing the required parameter 'permission' when calling UserPermissionsApi.authorize_user" end # resource path local_var_path = '/v1/users/{userId}/resources/{resourceUri}/permissions/{permission}'.sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'resourceUri' + '}', resource_uri.to_s).sub('{' + 'permission' + '}', .to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @authress_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @authress_client.config[:debugging] @authress_client.config[:logger].debug "API called: UserPermissionsApi#authorize_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#disable_user_token(user_id, token_id, opts = {}) ⇒ nil
Disable a token. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Permanently disable a token. To be used after the token has completed its use. Should be called on all tokens to ensure they are not active indefinitely.
<span class="badge badge-outline-secondary">CONTACT: AuthressSupport</span>
84 85 86 87 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 84 def disable_user_token(user_id, token_id, opts = {}) disable_user_token_with_http_info(user_id, token_id, opts) nil end |
#disable_user_token_with_http_info(user_id, token_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Disable a token. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Permanently disable a token. To be used after the token has completed its use. Should be called on all tokens to ensure they are not active indefinitely. <br><span class="badge badge-outline-secondary">CONTACT: AuthressSupport</span>
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 95 def disable_user_token_with_http_info(user_id, token_id, opts = {}) if @authress_client.config[:debugging] @authress_client.config[:logger].debug 'Calling API: UserPermissionsApi.disable_user_token ...' end # verify the required parameter 'user_id' is set if @authress_client.config[:client_side_validation] && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserPermissionsApi.disable_user_token" end # verify the required parameter 'token_id' is set if @authress_client.config[:client_side_validation] && token_id.nil? fail ArgumentError, "Missing the required parameter 'token_id' when calling UserPermissionsApi.disable_user_token" end # resource path local_var_path = '/v1/users/{userId}/tokens/{tokenId}'.sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'tokenId' + '}', token_id.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @authress_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @authress_client.config[:debugging] @authress_client.config[:logger].debug "API called: UserPermissionsApi#disable_user_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_user_permissions_for_resource(user_id, resource_uri, opts = {}) ⇒ PermissionCollection
Get the permissions a user has to a resource. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get a summary of the permissions a user has to a particular resource.
<span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
144 145 146 147 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 144 def (user_id, resource_uri, opts = {}) data, _status_code, _headers = (user_id, resource_uri, opts) data end |
#get_user_permissions_for_resource_with_http_info(user_id, resource_uri, opts = {}) ⇒ Array<(PermissionCollection, Integer, Hash)>
Get the permissions a user has to a resource. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get a summary of the permissions a user has to a particular resource. <br><span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 155 def (user_id, resource_uri, opts = {}) if @authress_client.config[:debugging] @authress_client.config[:logger].debug 'Calling API: UserPermissionsApi.get_user_permissions_for_resource ...' end # verify the required parameter 'user_id' is set if @authress_client.config[:client_side_validation] && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserPermissionsApi.get_user_permissions_for_resource" end # verify the required parameter 'resource_uri' is set if @authress_client.config[:client_side_validation] && resource_uri.nil? fail ArgumentError, "Missing the required parameter 'resource_uri' when calling UserPermissionsApi.get_user_permissions_for_resource" end # resource path local_var_path = '/v1/users/{userId}/resources/{resourceUri}/permissions'.sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'resourceUri' + '}', resource_uri.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @authress_client.select_header_accept(['application/links+json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'PermissionCollection' auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @authress_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @authress_client.config[:debugging] @authress_client.config[:logger].debug "API called: UserPermissionsApi#get_user_permissions_for_resource\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_user_resources(user_id, opts = {}) ⇒ UserResources
Get the resources a user has to permission to. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get the users resources. This result is a list of resource uris that a user has an explicit permission to, a user with * access to all sub resources will return an empty list. To get a user’s list of resources in this cases, it is recommended to also check explicit access to the collection resource, using the <strong>authorizeUser</strong> endpoint. In the case that the user only has access to a subset of resources in a collection, the list will be paginated.
<span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
209 210 211 212 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 209 def get_user_resources(user_id, opts = {}) data, _status_code, _headers = get_user_resources_with_http_info(user_id, opts) data end |
#get_user_resources_with_http_info(user_id, opts = {}) ⇒ Array<(UserResources, Integer, Hash)>
Get the resources a user has to permission to. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get the users resources. This result is a list of resource uris that a user has an explicit permission to, a user with * access to all sub resources will return an empty list. To get a user's list of resources in this cases, it is recommended to also check explicit access to the collection resource, using the <strong>authorizeUser</strong> endpoint. In the case that the user only has access to a subset of resources in a collection, the list will be paginated. <br><span class="badge badge-outline-secondary">READ: Authress:UserPermissions/userId</span>
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 264 265 266 267 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 223 def get_user_resources_with_http_info(user_id, opts = {}) if @authress_client.config[:debugging] @authress_client.config[:logger].debug 'Calling API: UserPermissionsApi.get_user_resources ...' end # verify the required parameter 'user_id' is set if @authress_client.config[:client_side_validation] && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserPermissionsApi.get_user_resources" end # resource path local_var_path = '/v1/users/{userId}/resources'.sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = opts[:query_params] || {} query_params[:'resourceUri'] = opts[:'resource_uri'] if !opts[:'resource_uri'].nil? query_params[:'permissions'] = opts[:'permissions'] if !opts[:'permissions'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @authress_client.select_header_accept(['application/links+json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'UserResources' auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @authress_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @authress_client.config[:debugging] @authress_client.config[:logger].debug "API called: UserPermissionsApi#get_user_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#request_user_token(body, user_id, opts = {}) ⇒ UserToken
Request a user token with additional configuration. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get an Authress signed JWT access token using with userId as the sub. Additionally, can be configured to limit the permissions for this particular token and the length of time the token is valid. Token validation is real-time, so deleted tokens are restricted from being used as soon as they are deleted. This gives full control to the user and client creating the token. Client must have access to impersonating the user in order to generate tokens on their behalf.
<span class="badge badge-outline-secondary">CONTACT: AuthressSupport</span>
274 275 276 277 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 274 def request_user_token(body, user_id, opts = {}) data, _status_code, _headers = request_user_token_with_http_info(body, user_id, opts) data end |
#request_user_token_with_http_info(body, user_id, opts = {}) ⇒ Array<(UserToken, Integer, Hash)>
Request a user token with additional configuration. <i class="far fa-money-bill-alt text-primary"></i> <span class="text-primary">Billable</span> Get an Authress signed JWT access token using with userId as the sub. Additionally, can be configured to limit the permissions for this particular token and the length of time the token is valid. Token validation is real-time, so deleted tokens are restricted from being used as soon as they are deleted. This gives full control to the user and client creating the token. Client must have access to impersonating the user in order to generate tokens on their behalf. <br><span class="badge badge-outline-secondary">CONTACT: AuthressSupport</span>
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 331 |
# File 'lib/authress-sdk/api/user_permissions_api.rb', line 285 def request_user_token_with_http_info(body, user_id, opts = {}) if @authress_client.config[:debugging] @authress_client.config[:logger].debug 'Calling API: UserPermissionsApi.request_user_token ...' end # verify the required parameter 'body' is set if @authress_client.config[:client_side_validation] && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling UserPermissionsApi.request_user_token" end # verify the required parameter 'user_id' is set if @authress_client.config[:client_side_validation] && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserPermissionsApi.request_user_token" end # resource path local_var_path = '/v1/users/{userId}/tokens'.sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @authress_client.select_header_accept(['application/links+json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @authress_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @authress_client.object_to_http_body(body) return_type = opts[:return_type] || 'UserToken' auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @authress_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @authress_client.config[:debugging] @authress_client.config[:logger].debug "API called: UserPermissionsApi#request_user_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |