It's all about the answers!

Ask a question

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


0
1
Shriraam Balasubramanian (402821) | asked Dec 18 '12, 7:31 a.m.
edited Jul 22 '15, 12:23 a.m.

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?


Accepted answer


permanent link
Sudarshan Rao (1863) | answered Dec 18 '12, 2:32 p.m.
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

3 other answers



permanent link
Daniel Moul (4.5k1115) | answered Dec 18 '12, 7:39 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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

permanent link
Shriraam Balasubramanian (402821) | answered Dec 18 '12, 7:46 a.m.
edited Jul 22 '15, 12:23 a.m.

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.



permanent link
Raphael Calvo (6) | answered Jul 20 '16, 7:43 a.m.
 
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"
}

Your answer


Register or to post your answer.