Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

"Read-Only Attributes for Condition" and Javascript Conditions

The Operation Behavior Precondition "Read-Only Attributes for Condition" in combination with Javascript Conditions shows unexpected behavior. If dedicated conditions for different roles are configured, wrong Conditions get executed! I can reproduce the failure with any web browser, while the Eclipse client works fine.

I executed following test with RTC versions 6.0/5.0.2 (local installation with Tomcat AS) and Webbrosers Firefox/IE/Chrome in a project area based on the default Scrum template:

1. Created two Javascript Conditions (Project Configuration -> Configuration Data -> Work Items -> Attribute Customizations -> Conditions):

Developer Condition
dojo.provide("com.example.DeveloperCondition");
(function() {
    dojo.declare("com.example.DeveloperCondition", null, {
        matches: function(workItem, configuration) {
            console.log("Developer Condition");
            return false;
        }
    });
})();

Everyone Condition
dojo.provide("com.example.EveryoneCondition");
(function() {
    dojo.declare("com.example.EveryoneCondition", null, {
        matches: function(workItem, configuration) {
            console.log("Everyone Condition");
            return true;
        }
    });
})();

2. Added Operation Behavior Precondition "Read-Only Attributes for Condition" to role Everyone, added Condition "Everyone Condition" and checked Attribute "Summary".

3. Added Operation Behavior Precondition "Read-Only Attributes for Condition" to role Developer, added Condition "Developer Condition" and checked Attribute "Summary".

4. Added a new user with role Developer to project area.

5. Logged on and tried to create a Task work item. The Everyone Condition is executed and Summary is read-only. Console log shows "Everyone Condition". But in fact the user has role Developer, otherwise he would not be able to save the Task work item.

6. After server reboot and logon the Developer Condition was executed during task creation. But then i revoked Developer role from user, still Developer Condition is executed during task creation until the server is rebooted.

So there seems to be some caching issue with the server. My web proxy was turned off. As mentioned before, only Web Browsers are affected, the Eclipse Client works fine.

Has anyone encountered this error before or knows about it's cause?

0 votes



2 answers

Permanent link
I read the question again and again and I will rephrase my answer.

I have seen issues with this while developing these conditions. I would like to suggest to use Ctrl-F5 or clearing the browser caches.

There is a another issue, in case you configure the conditions for every role. Only the first role that is found is actually computed. See: Process behavior lookup in Rational Team Concert 2.0 how that is done. Roles a user has, also depend on the context that owns the item. The order of the roles is also important, everyone is always the last role, however.

So your attempt is valid. But please be aware, you can not access the role of a user in JavaScript. You basically have no access to it. So the conditions above will have to be configured as you did and you don't know about the user role in the actual condition.

If you want to avoid the effort to configure that (and every other behavior you want for everyone) for all roles, you would take another approach.

1. Use a JavaScript based condition like A Custom Condition to Make Attributes Required or Read-Only by Role Version 2 where you can test for the role of the user in the condition. This way you only need to configure this for "Everyone" or if you configure different behavior for other roles.
2. Go the path Sam did and create a pre-condition. This way you only need to configure this for "Everyone" or if you configure different behavior for other roles.

0 votes


Permanent link
Rational Client Support was able to reproduce the issue and confirmed it as a bug: Defect 384588

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,125

Question asked: Dec 10 '15, 10:45 a.m.

Question was seen: 3,481 times

Last updated: Feb 22 '16, 11:18 a.m.

Confirmation Cancel Confirm