Hi Community |
Re: Delete an AccessRec you can use unset to remove access rights. (See section "unset, unsetDef, unsetVal, unsetAll" in page "controlling access".) Regards, Michael |
Re: Delete an AccessRec
Then you can adjust specific AccessRecords. -Louie |
Re: Delete an AccessRec
Copying Access Rights when you are not Administrator is tricky. You need to have control access by any means in the first place, either through a group your user or everyone rights. Then what you need to do is:
set (item, control | delete, "") // give everyone control permissions unsetAll (item) set (item, control | delete, "myUser")
AccessRec ar
Permission myPermission = none
bool bRemoveMe = true
// loop over the access records of the source item
for ar in sourceItem do {
string sUser = username ar
Permission perm = getPermission ar // this function needs to be made
// if this is an access record for our user, store it
if (sUser == sMyUserName) {
ourPermission = perm
bRemoveUs = false
} else {
// else copy it
set (targetItem, perm, sUser)
}
}
// now either remove or set our permissions
if (bRemoveUs) {
unset (targetItem, sMyUserName)
} else {
set (targetItem, myPermission , sMyUserName)
}
Permission getPermission (AccessRec ar) {
Permission result = none
if (read ar) result = result | read()
if (modify ar) result = result | modify()
if (create ar) result = result | create()
if (delete ar) result = result | delete()
if (control ar) result = result | control()
return result
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Delete an AccessRec Mathias Mamsch - Wed Sep 12 12:22:59 EDT 2012
Copying Access Rights when you are not Administrator is tricky. You need to have control access by any means in the first place, either through a group your user or everyone rights. Then what you need to do is:
set (item, control | delete, "") // give everyone control permissions unsetAll (item) set (item, control | delete, "myUser")
AccessRec ar
Permission myPermission = none
bool bRemoveMe = true
// loop over the access records of the source item
for ar in sourceItem do {
string sUser = username ar
Permission perm = getPermission ar // this function needs to be made
// if this is an access record for our user, store it
if (sUser == sMyUserName) {
ourPermission = perm
bRemoveUs = false
} else {
// else copy it
set (targetItem, perm, sUser)
}
}
// now either remove or set our permissions
if (bRemoveUs) {
unset (targetItem, sMyUserName)
} else {
set (targetItem, myPermission , sMyUserName)
}
Permission getPermission (AccessRec ar) {
Permission result = none
if (read ar) result = result | read()
if (modify ar) result = result | modify()
if (create ar) result = result | create()
if (delete ar) result = result | delete()
if (control ar) result = result | control()
return result
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
You cannot set your own access when you ARE the administrator and you don't need to; when you are then just erase the existing ones and copy over the other ones. -Louie |
Re: Delete an AccessRec llandale - Wed Sep 12 14:05:18 EDT 2012
Louie, you are right, one should check the username for Administrator in this line: if (sUserName != "Administrator") set (item, control | delete, sUserName)
set (current Module, read, "Administrator")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Delete an AccessRec Mathias Mamsch - Wed Sep 12 17:22:15 EDT 2012
Louie, you are right, one should check the username for Administrator in this line: if (sUserName != "Administrator") set (item, control | delete, sUserName)
set (current Module, read, "Administrator")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
So I guess I should have said "must not" instead of "cannot". -Louie There was bug like this vis-a-vis Adminstrator created views; v8.1 I think. |
Re: Delete an AccessRec My idea was to completely delete an Access Entry of my User "XYZ" (not setting Read Access). Deleting is possible, because the user is a member of "DBM" and "DBM" has full Access. Setting Read Access to "XYZ" doesn't work, because i would remove my own rights. The function i wanted to use is implemented in DOORS over: View->Manage Views->Select View->Access->Delete. Overall it seems, that this function is not implemented or published in DOORS Dxl Script. So it looks that i have to manually fix it. Maiko |
Re: Delete an AccessRec Maiko@Doors - Fri Sep 14 04:17:22 EDT 2012 May I ask why the solution proposed above by MichaelGeorg does not work in your case?
string s
View v = view("your new view")
AccessRec ar = get(v,"XYZ",s)
unset(v,"XYZ")
|
Re: Delete an AccessRec unset works. My mistake was, that my current Module wasn't the Module, where i created the view. So I changed the current Module and it works. Maiko |