Class: BrickFTP::RESTfulAPI::ListPermissions

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/brick_ftp/restful_api/list_permissions.rb

Overview

List permissions

Params

PARAMETER TYPE DESCRIPTION
path string Optional path to focus the result set on.

See Also:

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(path: nil) ⇒ Array<BrickFTP::Types::Permission>

Returns a list of permissions on the current site.

  • By default all permissions for the entire site are returned.
  • When given a path parameter, then only permissions immediately relevant to the given path are returned.
  • When using a path parameter, the result will include permissions on the current path and recursive permissions that are inherited from parent paths, except that lesser permissions will be excluded if a greater permission applies on the given path for a particular user or group.

Parameters:

  • path (String) (defaults to: nil)

    Folder path for the permission to apply to. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.

Returns:



33
34
35
36
37
38
39
# File 'lib/brick_ftp/restful_api/list_permissions.rb', line 33

def call(path: nil)
  endpoint = '/api/rest/v1/permissions.json'
  endpoint = "#{endpoint}?path=#{ERB::Util.url_encode(path)}" unless path.nil?
  res = client.get(endpoint)

  res.map { |i| BrickFTP::Types::Permission.new(**i.symbolize_keys) }
end