It's all about the answers!

Ask a question

Precondition "Read-Only Attributes for Type and State" and Team Areas


Stefan Oblinger (185213) | asked Dec 09 '15, 11:57 a.m.
We want that "Everyone" role should be able to comment on any work item. No other attributes should be allowed to be changed by Everyone role. We used precondition "Read-Only Attributes for Type and State" to configure the Everyone role accordingly: All work item attributes are configured as Read-Only except Comments.

This works fine as long was we don't use Team Areas. But if Users are only added to a Team Area, but not to the Project Area, users will not be able to create work items anymore even if they have the required roles configured in the Team Area. A user that creates a new work item gets Everyone role until he sets the "Category" and saves the work item. But due to the configuration of the Everyone role he is not allowed to set Category, Summary, ...

The problem is, that in the configuration of "Read-Only Attributes for Type and State" it is not possible to differentiate between the cases
  • modification of a work item in the initial state
  • creation of a new work item

How can we implement such a requirement? We don't want to additionally configure users and roles in the Project Area. We also don't want Everyone role to modify work items in their initial states - except for adding additional Comments.

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Dec 09 '15, 12:30 p.m.
we had a similar problem with new (on create) and new (after create).

I found and modified the code for the advisor to create a new setting for the create case.
I did not update the UI.

it was really the nothing -> new state transition save (create)
vs the new -> still new save
Stefan Oblinger selected this answer as the correct answer

Comments
sam detweiler commented Dec 10 '15, 7:00 a.m.

I added config thru the process config XML for the nothing->new case.. see the answer below, as I can't paste that much into a comment


sam detweiler commented Dec 10 '15, 7:01 a.m. | edited Dec 11 '15, 10:05 p.m.

here is the process xml for my advisor.. it IS the same as the product provided one, except I added the extra keyword, onCreate

so the product version is used for all the normal settings and our was used for just the create case.

                        <precondition description="required properties only during create" id="com.xx.extensions.advisor.requiredProperties" name="xx Required Properties Advisor">
                            <workflowProperties onCreate="true" stateId="s1" workItemType="defect">
                                <property id="com.ibm.team.workitem.attribute.severity"/>
                                <property id="com.ibm.team.workitem.attribute.version"/>
                                <property id="com.xx.id.workitem.attribute.feature"/>
                                <property id="com.xx.tools.workitem.attribute.detectedbygroup"/>
                            </workflowProperties>
                        </precondition>

One other answer



permanent link
Ralph Schoon (63.1k33646) | answered Dec 10 '15, 3:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 10 '15, 3:58 a.m.
https://rsjazz.wordpress.com/2015/08/07/a-custom-condition-to-make-attributes-required-or-read-only-by-role-version-2/ shows code that is derived from the internal code. You notice that it calculates the state in the condition and it is only interested in the target state. The target state for a work item is created is New. So as Sam said, you could basically steal the existing code and create a new advisor that prevents saving by your rules.

It will not update the UI with this information, if you want that, please read the section in https://rsjazz.wordpress.com/2015/08/07/a-custom-condition-to-make-attributes-required-or-read-only-by-role-version-2/ that discusses how that actually works.

You can use https://rsjazz.wordpress.com/2015/08/07/a-custom-condition-to-make-attributes-required-or-read-only-by-role-version-2/ or its predecessor, customize it for your purposes and use that, if you want the UI to show the read only information.

A custom pre condition/advisor is easier to maintain but it does not give the UI clue. A condition would require to maintain settings if you add attributes.

Comments
Stefan Oblinger commented Dec 11 '15, 5:21 a.m. | edited Dec 11 '15, 10:05 p.m.

 Thanks Sam and Ralph

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.