## org.freedesktop.impl.portal.PermissionStore org.freedesktop.impl.portal.PermissionStore — Database to store permissions |

## Methods

    Lookup           (IN  s      table,
                      IN  s      id,
                      OUT a{sas} permissions,
                      OUT v      data);
    Set              (IN  s      table,
                      IN  b      create,
                      IN  s      id,
                      IN  a{sas} app_permissions,
                      IN  v      data);
    Delete           (IN  s      table,
                      IN  s      id);
    SetValue         (IN  s      table,
                      IN  b      create,
                      IN  s      id,
                      IN  v      data);
    SetPermission    (IN  s      table,
                      IN  b      create,
                      IN  s      id,
                      IN  s      app,
                      IN  as     permissions);
    DeletePermission (IN  s      table,
                      IN  s      id,
                      IN  s      app);
    List             (IN  s      table,
                      OUT as     ids);

## Signals

    Changed (s      table,
             s      id,
             b      deleted,
             v      data,
             a{sas} permissions);

## Properties

    version  readable   u

## Description

The permission store can be used by portals to store permissions that sandboxed applications have to various resources, such as files outside the sandbox.

Since the resources managed by portals can be varied, the permission store is fairly free-form: there can be multiple tables; resources are identified by an ID, as are applications, and permissions are stored as string arrays. None of these strings are interpreted by the permission store in any way.

In addition, the permission store allows to associate extra data (in the form of a GVariant) with each resource.

This document describes version 2 of the permission store interface.

## Method Details

### The Lookup() method

    Lookup (IN  s      table,
            IN  s      id,
            OUT a{sas} permissions,
            OUT v      data);

Looks up the entry for a resource in one of the tables and returns all associated application permissions and data.

`IN s `table``: | the name of the table to use
`IN s `id``: | the resource ID to look up
`OUT a{sas} `permissions``: | map from application ID to permissions
`OUT v `data``: | data that is associated with the resource

### The Set() method

    Set (IN  s      table,
         IN  b      create,
         IN  s      id,
         IN  a{sas} app_permissions,
         IN  v      data);

Writes the entry for a resource in the given table.

`IN s `table``: | the name of the table to use
`IN b `create``: | whether to create the table if it does not exist
`IN s `id``: | the resource ID to modify
`IN a{sas} `app_permissions``: | map from application ID to permissions
`IN v `data``: | data to associate with the resource

### The Delete() method

    Delete (IN  s table,
            IN  s id);

Removes the entry for a resource in the given table.

`IN s `table``: | the name of the table to use
`IN s `id``: | the resource ID to delete

### The SetValue() method

    SetValue (IN  s table,
              IN  b create,
              IN  s id,
              IN  v data);

Sets just the data for a resource in the given table.

`IN s `table``: | the name of the table to use
`IN b `create``: | whether to create the table if it does not exist
`IN s `id``: | the resource ID to modify
`IN v `data``: | data to associate with the resource

### The SetPermission() method

    SetPermission (IN  s  table,
                   IN  b  create,
                   IN  s  id,
                   IN  s  app,
                   IN  as permissions);

Sets the permissions for an application and a resource in the given table.

`IN s `table``: | the name of the table to use
`IN b `create``: | whether to create the table if it does not exist
`IN s `id``: | the resource ID to modify
`IN s `app``: | the application ID to modify
`IN as `permissions``: | permissions to set

### The DeletePermission() method

    DeletePermission (IN  s table,
                      IN  s id,
                      IN  s app);

Removes the entry for an application and a resource in the given table.

This method was added in version 2.

`IN s `table``: | the name of the table to use
`IN s `id``: | the resource ID to modify
`IN s `app``: | the application ID to modify

### The List() method

    List (IN  s  table,
          OUT as ids);

Returns all the resources that are present in the table.

`IN s `table``: | the name of the table to use
`OUT as `ids``: | IDs of all resources that are present in the table

## Signal Details

### The "Changed" signal

    Changed (s      table,
             s      id,
             b      deleted,
             v      data,
             a{sas} permissions);

The Changed signal is emitted when the entry for a resource is modified or deleted. If the entry was deleted, then `data` and `permissions` contain the last values that were found in the database. If the entry was modified, they contain the new values.

`s `table``: | the name of the table
`s `id``: |
`b `deleted``: | whether the resource was deleted
`v `data``: | the data that is associated the resource
`a{sas} `permissions``: | the permissions that are associated with the resource

## Property Details

### The "version" property

    version  readable   u