# Permission ## Example Permission Object ``` { "id": 1, "path": "example", "user_id": 1, "username": "Sser", "group_id": 1, "group_name": "example", "permission": "full", "recursive": true } ``` * `id` (int64): Permission ID * `path` (string): Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. * `user_id` (int64): User ID * `username` (string): User's username * `group_id` (int64): Group ID * `group_name` (string): Group name if applicable * `permission` (string): Permission type * `recursive` (boolean): Does this permission apply to subfolders? --- ## List Permissions ``` Files::Permission.list( per_page: 1, path: "example", include_groups: true, group_id: 1, user_id: 1 ) ``` ### Parameters * `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[group_id]=desc`). Valid fields are `group_id`, `path`, `user_id` or `permission`. * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id, path ]`. * `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. * `path` (string): Permission path. If provided, will scope all permissions(including upward) to this path. * `include_groups` (boolean): If searching by user or group, also include user's permissions that are inherited from its groups? * `group_id` (string): * `user_id` (string): --- ## Create Permission ``` Files::Permission.create( group_id: 1, path: "example", permission: "full", recursive: true, user_id: 1, username: "Sser" ) ``` ### Parameters * `group_id` (int64): Group ID * `path` (string): Folder path * `permission` (string): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history` * `recursive` (boolean): Apply to subfolders recursively? * `user_id` (int64): User ID. Provide `username` or `user_id` * `username` (string): User username. Provide `username` or `user_id` --- ## Delete Permission ``` Files::Permission.delete(id) ``` ### Parameters * `id` (int64): Required - Permission ID. --- ## Delete Permission ``` permission = Files::Permission.list.first permission.delete ``` ### Parameters * `id` (int64): Required - Permission ID.