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

Can any one please help me to set the attribute in Read - Only mode by DXL Scripting in a view ?

Hi,

Can anyone please help me to set a particular attribute in Read-Only(For eg:HAR_Responsible Domain-Attribute) mode after running the script in a module using Exclusive Edit mode?


1

0 votes


Accepted answer

Permanent link
You cannot make an attribute read-only in just a view. If you make an attribute read-only, it will be read-only in all views. If this is what you're looking for, then the perm that would help you is - setVal. You can raise all such questions in the forum link posted by Daniel. That's a more popular forum for DXL related questions with active DXL users.

For now, here's a sample (to be run from within a module) -

string users = ""
AttrDef ad = find(current Module, "HAR_Responsible Domain")
string errMsg = setVal(current Module, ad, read, users)
if(!null errMsg)
  print "Error - " errMsg

Note - blank string assigned to users, indicates it is for the default group (Everyone or Everyone Else). If you would like to assign this read-only access to a specific user, you need to specify the Username of that user for the variable users.

If you have any follow-up questions, please post it in the DXL Forum.

Hope that helps.

Cheers,
Sudarshan

Shriraam Balasubramanian selected this answer as the correct answer

1 vote


3 other answers

Permanent link
DOORS NG does not currently support customer-written DXL scripts.

The DOORS 9 community is active at developerWorks. For example, the DXL forum is here: 
http://www.ibm.com/developerworks/forums/forum.jspa?forumID=1527

0 votes


Permanent link

Hi Daniel,

Thanks for your reference. I am not able to find the solution via DXL scripting there.

Please help me how to set it through DOORS Scripting.


0 votes


Permanent link
 
The first function is to set an attribute to read only.
The second function in this post is to set an attribute for read and modify permissions.
The input of both functions is the user which you are trying to set the permissions and the attribute.

Both functions can be improved to check if the module is in Exclusive Edit and if not to switch to exclusive edit mode.
Both functions can be improved to check if the user running these functions has the permissions to set permissions to other users.

------------------------

void setUserReadPermissions(string user, string attributeField)
{
AttrDef ad 
string userInput
Object obj = current
Module m = current

ad = find(current, attributeField) 

for ad in m do {
setDef(m, ad, read, user)
setVal(m, ad, read, user)
set(obj, read, user)
synchExplorer(m)
refreshExplorer(m)
refresh(m)
}
print " Read Only permissions were attributed to  " user "for the attribute" attributeField ". \n"
}


------------------------------------------------------------------------------------
 void setUserModifyPermissions(string user, string attributeField)
{
AttrDef ad 
string  userInput
Object  obj  = current
Module  = current

ad = find(current, attributeField) 

for ad in m do {
setDef(m, ad, read|modify, user)
setVal(m, ad, read|modify, user)
set(obj, read|modify, user)
synchExplorer(m)
refreshExplorer(m)
refresh(m)
}
print " Modify permissions were attributed to  " user "for the attribute" attributeField ". \n"
}

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
× 198

Question asked: Dec 18 '12, 7:31 a.m.

Question was seen: 9,206 times

Last updated: Jul 20 '16, 7:43 a.m.

Confirmation Cancel Confirm