Submit a request
Submit a request

Restricting Access Using Filtering in Item and Activity List

This article outlines how to restrict access to Items and Activities based on a combination of users, Tags, and status values.

The filter.restricted object of item_list and activity_list allows you to filter out the list of Items and Activities you would want your users to access in your application. You can filter Items and Activities based on the users who have created the Items and Activities, Tags attached to them or the status of the Item.

You can restrict the list of Items in the item_list and Activities in the activity_list to only those Items and Activities created by users specified in the array of user.ids. To do this, you will use the filter.restricted.created_by initialization options. A maximum of 50 user.id values can be specified in the string array. The user.id is the user_id value for the user used to create the signed request to initialise Author API and create the Item or Activity.

Using the filter.restricted.current_user initialization flag, you can restrict the list of Items in the item_list and Activities in the activity_list for the authors to only the Items and Activities created by them. This flag overrides the created_by option and will not display any Items or Activities created by any other author.

Using the filter.restricted.status initialization option, you can restrict the list of Items in the item_list to only those Items whose status is set to the any of the value specified in the string array. Valid status for Items are publishedunpublished, and archived.

If a Tag filter is specified and a user should be allowed to create Items or Activities, Tags matching that filter will need to be set on Item creation (using the setItemTags public method) for the Item to be visible in the item_list and on Activity creation (using the setActivityTags public method) for the Activity to be visible in the activity_list.

See the article on advanced tag search for examples of Tag formats.

Using the filter.restricted.tags.all initialization option, you can restrict the list of Items in the item_list and Activities in the activity_list for the authors to only those Items and Activities which have all the Tags specified in the object array. The object array is an array of Tag objects in the TagsV2 object format. You can specify the type and name properties for each Tag object, or just the type property in which case the name value would be ignored. You can also specify an array of name properties for the specified type in the TagsV1 format which makes it more convenient to specify multiple Tags of the same type.

Using the filter.restricted.tags.either initialization option, you can restrict the list of Items in the item_list and Activities in the activity_list for the authors to only those Items and Activities which have at least one Tag matching the Tags specified in the object array. The object array is an array of Tag objects in the TagsV2 object format. You can also specify an array of name properties for the specified type in the TagsV1 format for the item_list which makes it more convenient to specify multiple Tags of the same type.

Using the filter.restricted.tags.none initialization option, you can restrict the list of Items in the item_list and Activities in the activity_list for the authors to only those Items and Activities which do not have any Tags matching the Tags specified in the object array. The object array is an array of Tag objects in the TagsV2 object format. 

Note: For performance reasons, none Tags are only allowed if all or either Tags filter are specified as well. If not specified, the none Tags filter will be ignored.

Was this article helpful?
0 out of 1 found this helpful

Did you arrive here by accident? If so, learn more about Learnosity by clicking here.