Module: KindeSdk::Client::Permissions
Instance Method Summary collapse
-
#get_permission(permission, options = {}) ⇒ Hash
Get a specific permission status.
-
#get_permissions(options = {}) ⇒ Hash
Get all permissions for the authenticated user Matches the JavaScript SDK API: getPermissions(options?).
-
#get_permissions_legacy(token_type = :access_token) ⇒ Object
Backward compatibility method - matches existing Ruby SDK API.
-
#getAllPermissions ⇒ Array
(also: #all_permissions)
Get all permissions with automatic pagination (hard check) Matches PHP: $client->getAllPermissions().
-
#getPermissions ⇒ Hash
PHP SDK compatible alias for get_permissions with hard check Matches PHP: $client->getPermissions().
-
#permission_granted?(permission, options = {}) ⇒ Boolean
Check if a permission is granted.
Methods included from Logging
#log_debug, #log_error, #log_info, #log_warning, resolve_logger, write_log
Instance Method Details
#get_permission(permission, options = {}) ⇒ Hash
Get a specific permission status
49 50 51 52 53 54 55 56 |
# File 'lib/kinde_sdk/client/permissions.rb', line 49 def (, = {}) = () { org_code: [:org_code], is_granted: [:permissions]&.include?() || false } end |
#get_permissions(options = {}) ⇒ Hash
Get all permissions for the authenticated user Matches the JavaScript SDK API: getPermissions(options?)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kinde_sdk/client/permissions.rb', line 25 def ( = {}) # Handle legacy positional argument for backward compatibility if .is_a?(Symbol) = { token_type: } end # Extract options with defaults - use member variable if not overridden force_api = [:force_api] || @force_api || false token_type = [:token_type] || :access_token if force_api # Hard check - call API for fresh permissions else # Soft check - extract from token claims (token_type) end end |
#get_permissions_legacy(token_type = :access_token) ⇒ Object
Backward compatibility method - matches existing Ruby SDK API
92 93 94 |
# File 'lib/kinde_sdk/client/permissions.rb', line 92 def (token_type = :access_token) get_claim("permissions", token_type)&.dig(:value) end |
#getAllPermissions ⇒ Array Also known as: all_permissions
Get all permissions with automatic pagination (hard check) Matches PHP: $client->getAllPermissions()
81 82 83 84 85 86 |
# File 'lib/kinde_sdk/client/permissions.rb', line 81 def getAllPermissions # Use client's force_api setting, default to true for PHP SDK compatibility force_api_setting = @force_api.nil? ? true : @force_api = (force_api: force_api_setting) [:permissions] || [] end |
#getPermissions ⇒ Hash
PHP SDK compatible alias for get_permissions with hard check Matches PHP: $client->getPermissions()
71 72 73 74 75 |
# File 'lib/kinde_sdk/client/permissions.rb', line 71 def getPermissions # Use client's force_api setting, default to true for PHP SDK compatibility force_api_setting = @force_api.nil? ? true : @force_api (force_api: force_api_setting) end |
#permission_granted?(permission, options = {}) ⇒ Boolean
Check if a permission is granted
63 64 65 |
# File 'lib/kinde_sdk/client/permissions.rb', line 63 def (, = {}) (, )[:is_granted] end |