# AccessStore

## Functions

### setAccess

```solidity
function setAccess(
    bytes32 accessID,
    Access memory a,
    address signer,
    uint deadline,
    bytes calldata signature
) external returns(AccessAction)
```

Sets the access level to the object

#### **Parameters**

<table><thead><tr><th width="152">Name</th><th width="158">Type</th><th width="417">Description</th></tr></thead><tbody><tr><td>accessID</td><td>bytes32</td><td></td></tr><tr><td>a</td><td><a data-mention href="#access">#access</a></td><td></td></tr><tr><td>signer</td><td>address</td><td>Address of the signer of the request</td></tr><tr><td>deadline</td><td>uint</td><td>Expiration timestamp of the request</td></tr><tr><td>signature</td><td>bytes</td><td>Cryptographic signature of the request performed by the signer's key</td></tr></tbody></table>

#### Return Values:

<table><thead><tr><th width="152">Name</th><th width="189">Type</th><th width="334">Description</th></tr></thead><tbody><tr><td>action</td><td><a data-mention href="#accessaction">#accessaction</a></td><td></td></tr></tbody></table>

### getAccess

```solidity
function getAccess(bytes32 accessID) external view returns(Access[] memory)
```

Retrieving access level information

#### **Parameters**

<table><thead><tr><th width="152">Name</th><th width="126">Type</th><th width="452">Description</th></tr></thead><tbody><tr><td>accessID</td><td>bytes32</td><td></td></tr></tbody></table>

#### Return Values:

<table><thead><tr><th width="152">Name</th><th width="126">Type</th><th width="452">Description</th></tr></thead><tbody><tr><td>access</td><td><a data-mention href="#access">#access</a></td><td></td></tr></tbody></table>

### getAccessByIdHash

```solidity
function getAccessByIdHash(
    bytes32 accessID,
    bytes32 accessIdHash
) public view returns(Access memory)
```

Retrieving access level information by idHash

#### **Parameters**

<table><thead><tr><th width="172">Name</th><th width="126">Type</th><th width="397">Description</th></tr></thead><tbody><tr><td>accessID</td><td>bytes32</td><td>Subject ID</td></tr><tr><td>accessIdHash</td><td>bytes32</td><td>Object ID hash</td></tr></tbody></table>

#### Return Values:

<table><thead><tr><th width="152">Name</th><th width="126">Type</th><th width="452">Description</th></tr></thead><tbody><tr><td>access</td><td><a data-mention href="#access">#access</a></td><td></td></tr></tbody></table>

### userAccess

```solidity
function userAccess(
    bytes32 userIDHash,
    AccessKind kind,
    bytes32 idHash
) external view returns (Access memory)
```

Retrieving information about a user's access level, taking into account his membership in user groups.

#### **Parameters**

<table><thead><tr><th width="172">Name</th><th width="154">Type</th><th width="391">Description</th></tr></thead><tbody><tr><td>userIDHash</td><td>bytes32</td><td>User ID hash</td></tr><tr><td>kind</td><td><a data-mention href="#accesskind">#accesskind</a></td><td></td></tr><tr><td>idHash</td><td>bytes32</td><td>Object ID hash</td></tr></tbody></table>

#### Return Values:

<table><thead><tr><th width="152">Name</th><th width="126">Type</th><th width="452">Description</th></tr></thead><tbody><tr><td>access</td><td><a data-mention href="#access">#access</a></td><td></td></tr></tbody></table>

## Models

### AccessKind

```solidity
enum AccessKind { NoKind, Doc, DocGroup, UserGroup }
```

### AccessLevel

```solidity
enum AccessLevel { NoAccess, Owner, Admin, Read }
```

### AccessAction

```solidity
enum AccessAction { NoAction, Update, Insert }
```

### Access

```solidity
struct Access {
    AccessKind   kind;
    bytes32      idHash;
    bytes        idEncr;
    bytes        keyEncr;
    AccessLevel  level;
}
```

#### **Parameters**

<table><thead><tr><th width="152">Name</th><th width="190">Type</th><th width="393">Description</th></tr></thead><tbody><tr><td>kind</td><td><a data-mention href="#accesskind">#accesskind</a></td><td></td></tr><tr><td>idHash</td><td>bytes32</td><td></td></tr><tr><td>idEncr</td><td>bytes</td><td>id encrypted by access key</td></tr><tr><td>keyEncr</td><td>bytes</td><td>access key encrypted by user private key</td></tr><tr><td>level</td><td><a data-mention href="#accesslevel">#accesslevel</a></td><td></td></tr></tbody></table>
