---
title: "admShareFilter"
canonical: "https://support.appfire.com/space/PSJ/15489490/admShareFilter"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | admShareFilter(filterId, shareType, [ shareRight [, shareName [,roleName ]]]) | **Package** |  |
| **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Add shares to a filter based on project, role, group, user.Add shares to a filter based on project, role, group, user.

Add shares to a filter based on project, role, group, user.Add shares to a filter based on project, role, group, user. For each call of this function a new set of shares will be added on top of the existing ones.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| filterId | number | Yes | The filter id. |
| shareType | String | Yes | The share type.The share type can be: "**project**", "**group**", "**user**", "**global**", "**loggedin**". |
| shareRight | String | No | The share right. The share right can be: "**view**", "**edit**". |
| shareName | String | No | The share name is dependent of the share type. It represents the actual name of the project, user or group for sharing the filter. For the **project** shareType the shareName is the actual **key** of the project.For the **group** shareType the shareName is the **group name**.For the **user** shareType the shareName is the **user name**. |
| roleName | String | No | The role name is an extra parameter when sharing the filter on a project that will further restrict based on role as well. |

## Return Type

**Boolean (true/false)**

Returns true if the operation succeeded.

## Example

```
number filterId = createFilter("TestFilter", "Description", "project = TEST", "admin"); // this will create a filter with no shares(private filter)


// for global and loggedin share type, the default shareRight is view 
admShareFilter(filterId , "global"); // all the users(logged in or not will have view permissions for the created filter)
admShareFilter(filterId , "loggedin"); // only the logged in users will have the permissions for this filter (also only for viewing)


//the user admin will have permissions for both view and editing
admShareFilter(filterId , "user", "view" ,"admin");
admShareFilter(filterId , "user", "edit" ,"admin");


//the permissions are now set for project test for view and edit
admShareFilter(filterId , "project", "view" ,"TEST");
admShareFilter(filterId , "project", "edit" ,"TEST");


//the permissions are now set for project test for view and edit AND as an extra restriction based on the "Administrators" role
admShareFilter(filterId , "project", "view" ,"TEST","Administrators");
admShareFilter(filterId , "project", "edit" ,"TEST", "Administrators");

//the users from the "jira-administrators" group will have permissions for this filter
admShareFilter(filterId , "group", "view" ,"jira-administrators");
admShareFilter(filterId , "group", "edit" ,"jira-administrators");
```

## See also

> Macro (contentbylabel)