> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# Permissions

> Permission allows you to manage permissions for IP Accounts within Story.

## Permission

### Methods

* set\_permission
* create\_set\_permission\_signature
* set\_all\_permissions

### set\_permission

Sets the permission for a specific function call.

Each policy is represented as a mapping from an IP account address to a signer address to a recipient
address to a function selector to a permission level. The permission level can be 0 (ABSTAIN), 1 (ALLOW), or
2 (DENY).

By default, all policies are set to 0 (ABSTAIN), which means that the permission is not set. The owner of IP Account by default has all permission.

| Method           |
| ---------------- |
| `set_permission` |

Parameters:

* `ip_id`: The IP ID that grants the permission for `signer`.
* `signer`: The address that can call `to` on behalf of the `ipAccount`.
* `to`: The address that can be called by the `signer` (currently only modules can be `to`)
* `permission`: The new permission level.
* `func`: \[Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. By default, it allows all functions.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  set_permission_response = story_client.Permission.set_permission(
    ip_id="0x01",
    signer="0x1234567890123456789012345678901234567890",
    to="0x2345678901234567890123456789012345678901",
    permission=1,  # ALLOW
    func="0x12345678"  # Optional function selector
  )
  ```

  ```python Request Parameters theme={null}
  ip_id: str  # The IP ID that grants the permission for signer
  signer: str  # The address that can call to on behalf of the ipAccount
  to: str  # The address that can be called by the signer (currently only modules can be to)
  permission: int  # The new permission level (0=ABSTAIN, 1=ALLOW, 2=DENY)
  func: str = "0x00000000"  # Optional: The function selector string
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

### create\_set\_permission\_signature

Specific permission overrides wildcard permission with signature.

| Method                            |
| --------------------------------- |
| `create_set_permission_signature` |

Parameters:

* `ip_id`: The IP ID that grants the permission for `signer`.
* `signer`: The address that can call `to` on behalf of the `ipAccount`.
* `to`: The address that can be called by the `signer` (currently only modules can be `to`)
* `permission`: The new permission level.
* `func`: \[Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. By default, it allows all functions.
* `deadline`: \[Optional] The deadline for the signature in milliseconds, default is 1000ms.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.PermissionClient.create_set_permission_signature(
    ip_id="0x01",
    signer="0x1234567890123456789012345678901234567890",
    to="0x2345678901234567890123456789012345678901",
    permission=1,  # ALLOW
    func="0x12345678",  # Optional function selector
    deadline=1000  # Optional deadline in milliseconds
  )
  ```

  ```python Request Parameters theme={null}
  ip_id: str  # The IP ID that grants the permission for signer
  signer: str  # The address that can call to on behalf of the ipAccount
  to: str  # The address that can be called by the signer (currently only modules can be to)
  permission: int  # The new permission level (0=ABSTAIN, 1=ALLOW, 2=DENY)
  func: str = "0x00000000"  # Optional: The function selector string
  deadline: int = None  # Optional: The deadline for the signature in milliseconds
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

### set\_all\_permissions

Sets permission to a signer for all functions across all modules.

| Method                |
| --------------------- |
| `set_all_permissions` |

Parameters:

* `ip_id`: The IP ID that grants the permission for `signer`.
* `signer`: The address of the signer receiving the permissions.
* `permission`: The new permission.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.PermissionClient.set_all_permissions(
    ip_id="0x01",
    signer="0x1234567890123456789012345678901234567890",
    permission=1  # ALLOW
  )
  ```

  ```python Request Parameters theme={null}
  ip_id: str  # The IP ID that grants the permission for signer
  signer: str  # The address of the signer receiving the permissions
  permission: int  # The new permission level (0=ABSTAIN, 1=ALLOW, 2=DENY)
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>
