How to allow/restrict a user to update a certain attribute on a specific object?

Johannes Buverud
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 1, 2018

We have an object type called "User". One of the attributes on this object type is called "Work place". The value of this attribute should be maintained (selected) by the user itself. None of the others attributes should be editable by these users. Also, the user should only be able to edit the object representing the current user.

I.E. Tom Bombadil should only be allowed to edit the object the attribute "Workplace" on object "Tom Bombadil" etc., and not the object "Slart I. Bartfast".

(The "User" object type have another attribute that is mapped to the Jira user. The attribute "Work place" is a reference to another object type consisting of all the work places in our organization.)

I think achieving this restriction is not possible within Insight itself.

But maybe I could have a request in the Jira Service Desk Portal containing the Insight Custom Field "Work place", where the user would pick his work place from the list, and then having a post function to update the object of the current user?

Or is there another way maybe?

2 answers

1 accepted

0 votes
Answer accepted
Yinon Negev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2018

Hi Johannes.

As you noted, Insight by itself does not yet support Attribute Permissions, only Object Type level permissions.

We do have several Feature Requests which you can vote on - to have these Permissions.

As for the use of Postfunction - yes, this should work:

  1. On a Transition Screen; have the Insight Object CF "Work Place" to be populated by the User from the available "Work Places" Objects (note that you can limit the list by your CF IQL filters).
  2. You should then have another Insight CF on this Issue (it can be hidden in the Transition) with a Filter Scope: objectType = "User", Filter Issue Scope and Filter Assign Scope (Strict = True) like: "Jira User" = ${reporter} //assuming the "Jira User" Attribute is the Attribute of "User" that is mapped to the Jira User related to this "User" Object.
  3. Use the Postfunction: Change Insight Value into Insight Object  where the Source CF is "Work Place", the Change Type is "Set", and the Target CF is where the "User" object is Populated.
  4. Alternatively, you can use Set the value of an object attribute with a predefined value: Where the Source CF is where the "User" Object is populated, the Attribute to be populated is the "Work Place" Attribute, and the Predefined value is a placeholder for the "Work Place" CF, e.g. ${Work Place}.
  5. Note that for this to work correctly - the Postfunction should be placed LAST in the postfunctions Order - so that the User CF will be populated first, then the selected User Objects will have its Attribute Set accordingly.

Please let us know if you require additional information.

Kind regards,

Yinon

Team Riada

Johannes Buverud
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2018

This works perfect, and no scripting required:)

Thanks!

0 votes
Johannes Buverud
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2018

I am trying to do what I described above; having a request presenting the user with a drop down list of "Work place" (Insight custom field), and then running an Insight post function setting the chosen "Work place" as the new attribute value on the curent user, but I can not make it work.

I am using this script as basis:

https://documentation.riada.io/insight/latest/insight-advanced-usage-guide/insight-for-developers/groovy-scripting/groovy-script-examples/post-functions/update-object-attribute

Which of the Insight post functions should I use?

https://documentation.riada.io/insight/latest/insight-administrator-s-guide/insight-workflow-functions/insight-post-functions

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events