Hello,
can somebody provide the easiest way to get the Username (login name) by the System username property using DXL? I need to check if a user can modify an Item based on its System username.
Thank you! JulianH - Mon Mar 27 05:21:27 EDT 2017 |
Re: Get Username by System username
User user
bool DAccnt = false
int i = 1
for user in userList do
{
DAcct = user.disabled
if (DAcct == false)
{
string strName
strName = user.name
string SysName = user.systemLoginName
print "\t" strName "\t" SysName "\n"
i = i + 1
}
}
Something like this work for what you need? |
Re: Get Username by System username If you want to know, whether a user can modify some object, why not use the bool canModify(objcect) or the bool canModify(attribute) functions/perms of DXL? |
Re: Get Username by System username MrNiceGuy - Mon Mar 27 16:25:32 EDT 2017
User user
bool DAccnt = false
int i = 1
for user in userList do
{
DAcct = user.disabled
if (DAcct == false)
{
string strName
strName = user.name
string SysName = user.systemLoginName
print "\t" strName "\t" SysName "\n"
i = i + 1
}
}
Something like this work for what you need? Hi,
I guess that this could work but I was hoping that there is any function that does not need to iterate over all users of the database. So there isn't sth. like findUserBySystemUsername(name)?
Thank you! |
Re: Get Username by System username You can ask for the DOORS user: User me = find() string nam = me.name string fnam = me.fullName string sys = me.systemLoginName print "I am: " nam " = " fnam "\n" print "system name: " sys "\n" print "logged in as: " username() "\n" But(!) the systemLoginName is an optional field in the DOORS account and must not be filled in: it can be empty!
|
Re: Get Username by System username thsturm - Tue Mar 28 05:20:05 EDT 2017 You can ask for the DOORS user: User me = find() string nam = me.name string fnam = me.fullName string sys = me.systemLoginName print "I am: " nam " = " fnam "\n" print "system name: " sys "\n" print "logged in as: " username() "\n" But(!) the systemLoginName is an optional field in the DOORS account and must not be filled in: it can be empty!
And in addition there can be more than one DOORS user that has the same system username. I guess this could pose a problem to you unless you are very sure, that this case does not happen to you. But: No there is no other way than iterating through the userlist, but why would this be a problem? Regards, Mathias |