Permission Sets

class Permission_Sets(session_kwargs, client, return_type='raw')

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.permission_sets.list(...)

Methods

delete_resources(id, name)

Delete a resource in a permission set

delete_resources_shares_groups(id, name, ...)

Revoke the permissions a group has on this object

delete_resources_shares_users(id, name, user_id)

Revoke the permissions a user has on this object

delete_shares_groups(id, group_id)

Revoke the permissions a group has on this object

delete_shares_users(id, user_id)

Revoke the permissions a user has on this object

get(id)

Get a Permission Set

get_resources(id, name)

Get a resource in a permission set

list(*[, archived, author, limit, page_num, ...])

List Permission Sets

list_dependencies(id, *[, user_id])

List dependent objects for this object

list_resources(id, *[, limit, page_num, ...])

List resources in a permission set

list_resources_shares(id, name)

List users and groups permissioned on this object

list_shares(id)

List users and groups permissioned on this object

list_users_permissions(id, user_id)

Get all permissions for a user, in this permission set

patch(id, *[, name, description])

Update some attributes of this Permission Set

patch_resources(id, name, *[, description])

Update a resource in a permission set

post(name, *[, description])

Create a Permission Set

post_resources(id, name, *[, description])

Create a resource in a permission set

put(id, name, *[, description])

Replace all attributes of this Permission Set

put_archive(id, status)

Update the archive status of this object

put_resources_shares_groups(id, name, ...[, ...])

Set the permissions groups has on this object

put_resources_shares_users(id, name, ...[, ...])

Set the permissions users have on this object

put_shares_groups(id, group_ids, ...[, ...])

Set the permissions groups has on this object

put_shares_users(id, user_ids, ...[, ...])

Set the permissions users have on this object

put_transfer(id, user_id, ...[, email_body, ...])

Transfer ownership of this object to another user

delete_resources(id: int, name: str)

Delete a resource in a permission set

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

Returns:
None

Response code 204: success

delete_resources_shares_groups(id: int, name: str, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_resources_shares_users(id: int, name: str, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

delete_shares_groups(id: int, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_shares_users(id: int, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID of the resource that is shared.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

get(id: int)

Get a Permission Set

Parameters:
idint
Returns:
civis.response.Response
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

get_resources(id: int, name: str)

Get a resource in a permission set

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

Returns:
civis.response.Response
  • permission_set_idint

    The ID for the permission set this resource belongs to.

  • namestr

    The name of this resource.

  • descriptionstr

    A description of this resource.

  • created_at : str (time)

  • updated_at : str (time)

list(*, archived: str = None, author: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List Permission Sets

Parameters:
archivedstr, optional

The archival status of the requested item(s).

authorstr, optional

If specified, return items from any of these authors. It accepts a comma- separated list of user IDs.

limitint, optional

Number of results to return. Defaults to 20. Maximum allowed is 50.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

list_dependencies(id: int, *, user_id: int = None)

List dependent objects for this object

Parameters:
idint

The ID of the resource that is shared.

user_idint, optional

ID of target user

Returns:
civis.response.Response
  • object_typestr

    Dependent object type

  • fco_typestr

    Human readable dependent object type

  • idint

    Dependent object ID

  • namestr

    Dependent object name, or nil if the requesting user cannot read this object

  • permission_levelstr

    Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

  • descriptionstr

    Additional information about the dependency, if relevant

  • shareablebool

    Whether or not the requesting user can share this object.

list_resources(id: int, *, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List resources in a permission set

Parameters:
idint

The ID for this permission set.

limitint, optional

Number of results to return. Defaults to 50. Maximum allowed is 1000.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to name. Must be one of: name, id, updated_at, created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to asc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • permission_set_idint

    The ID for the permission set this resource belongs to.

  • namestr

    The name of this resource.

  • descriptionstr

    A description of this resource.

  • created_at : str (time)

  • updated_at : str (time)

list_resources_shares(id: int, name: str)

List users and groups permissioned on this object

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

list_shares(id: int)

List users and groups permissioned on this object

Parameters:
idint

The ID of the resource that is shared.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

list_users_permissions(id: int, user_id: int)

Get all permissions for a user, in this permission set

Parameters:
idint

The ID for this permission set.

user_idint

The ID for the user.

Returns:
civis.response.Response
  • resource_namestr

    The name of the resource.

  • readbool

    If true, the user has read permission on this resource.

  • writebool

    If true, the user has write permission on this resource.

  • managebool

    If true, the user has manage permission on this resource.

patch(id: int, *, name: str = None, description: str = None)

Update some attributes of this Permission Set

Parameters:
idint

The ID for this permission set.

namestr, optional

The name of this permission set.

descriptionstr, optional

A description of this permission set.

Returns:
civis.response.Response
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

patch_resources(id: int, name: str, *, description: str = None)

Update a resource in a permission set

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

descriptionstr, optional

A description of this resource.

Returns:
civis.response.Response
  • permission_set_idint

    The ID for the permission set this resource belongs to.

  • namestr

    The name of this resource.

  • descriptionstr

    A description of this resource.

  • created_at : str (time)

  • updated_at : str (time)

post(name: str, *, description: str = None)

Create a Permission Set

Parameters:
namestr

The name of this permission set.

descriptionstr, optional

A description of this permission set.

Returns:
civis.response.Response
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

post_resources(id: int, name: str, *, description: str = None)

Create a resource in a permission set

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

descriptionstr, optional

A description of this resource.

Returns:
civis.response.Response
  • permission_set_idint

    The ID for the permission set this resource belongs to.

  • namestr

    The name of this resource.

  • descriptionstr

    A description of this resource.

  • created_at : str (time)

  • updated_at : str (time)

put(id: int, name: str, *, description: str = None)

Replace all attributes of this Permission Set

Parameters:
idint

The ID for this permission set.

namestr

The name of this permission set.

descriptionstr, optional

A description of this permission set.

Returns:
civis.response.Response
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

put_archive(id: int, status: bool)

Update the archive status of this object

Parameters:
idint

The ID of the object.

statusbool

The desired archived status of the object.

Returns:
civis.response.Response
  • idint

    The ID for this permission set.

  • namestr

    The name of this permission set.

  • descriptionstr

    A description of this permission set.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

put_resources_shares_groups(id: int, name: str, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_resources_shares_users(id: int, name: str, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID for this permission set.

namestr

The name of this resource.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_shares_groups(id: int, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_shares_users(id: int, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID of the resource that is shared.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_transfer(id: int, user_id: int, include_dependencies: bool, *, email_body: str = None, send_email: bool = None)

Transfer ownership of this object to another user

Parameters:
idint

The ID of the resource that is shared.

user_idint

ID of target user

include_dependenciesbool

Whether or not to give manage permissions on all dependencies

email_bodystr, optional

Custom body text for e-mail sent on transfer.

send_emailbool, optional

Send email to the target user of the transfer?

Returns:
civis.response.Response
  • dependenciesList[dict]

    Dependent objects for this object

    • object_typestr

      Dependent object type

    • fco_typestr

      Human readable dependent object type

    • idint

      Dependent object ID

    • namestr

      Dependent object name, or nil if the requesting user cannot read this object

    • permission_levelstr

      Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

    • descriptionstr

      Additional information about the dependency, if relevant

    • sharedbool

      Whether dependent object was successfully shared with target user