//How to get User Roles for different available companies
static void UserRolebyCompany(Args _args)
{
TextIo txIoRead,txIoWrite;
FileIOPermission fioPermission;
container containFromRead;
int xx,iConLength;
str sTempPath,sFileName = "UserRolebyCompany.txt", sOneRecord;
SecurityUserRole SecurityUserRole;
SecurityUserRoleCondition SecurityUserRoleCondition;
SecurityRole SecurityRole ;
UserInfo userInfo;
Company comp;
container cont;
;
//To Get the temporary file path.
sTempPath = WINAPI::getTempPath();
info("File is at: " + sTempPath + sFileName);
// Assert permission for file.
fioPermission = new FileIOPermission
(sTempPath + sFileName ,"RW");
fioPermission.assert();
// If the test file already exists, delete it.
if (WINAPI::fileExists(sFileName))
{
WINAPI::deleteFile(sTempPath + sFileName);
}
// "W" mode overwrites existing content, or creates the file.
txIoWrite = new TextIo( sTempPath + sFileName ,"W");
while select SecurityUserRole
{
cont = conNull();
select SecurityRole where SecurityRole .RecId == SecurityUserRole.SecurityRole;
select userInfo where userInfo.id == SecurityUserRole.User;
while select SecurityUserRoleCondition where SecurityUserRoleCondition.SecurityUserRole
== SecurityUserRole.RecId
{
cont += SecurityUserRoleCondition.DataArea;
}
if(!cont)
{
txIoWrite.write(strFmt("%1 -- %2 -- %3 -- %4 -- %5 -- %6",userInfo.name,
userInfo.networkAlias,userInfo.company,SecurityUserRole.User, SecurityRole .Name,"ALL"));
}
else
{
txIoWrite.write(strFmt("%1 -- %2 -- %3 -- %4 -- %5 -- %6",userInfo.name,
userInfo.networkAlias,userInfo.company,SecurityUserRole.User, SecurityRole
.Name,con2StrUnlimited(cont, ',')));
}
}
}
static void UserRolebyCompany(Args _args)
{
TextIo txIoRead,txIoWrite;
FileIOPermission fioPermission;
container containFromRead;
int xx,iConLength;
str sTempPath,sFileName = "UserRolebyCompany.txt", sOneRecord;
SecurityUserRole SecurityUserRole;
SecurityUserRoleCondition SecurityUserRoleCondition;
SecurityRole SecurityRole ;
UserInfo userInfo;
Company comp;
container cont;
;
//To Get the temporary file path.
sTempPath = WINAPI::getTempPath();
info("File is at: " + sTempPath + sFileName);
// Assert permission for file.
fioPermission = new FileIOPermission
(sTempPath + sFileName ,"RW");
fioPermission.assert();
// If the test file already exists, delete it.
if (WINAPI::fileExists(sFileName))
{
WINAPI::deleteFile(sTempPath + sFileName);
}
// "W" mode overwrites existing content, or creates the file.
txIoWrite = new TextIo( sTempPath + sFileName ,"W");
while select SecurityUserRole
{
cont = conNull();
select SecurityRole where SecurityRole .RecId == SecurityUserRole.SecurityRole;
select userInfo where userInfo.id == SecurityUserRole.User;
while select SecurityUserRoleCondition where SecurityUserRoleCondition.SecurityUserRole
== SecurityUserRole.RecId
{
cont += SecurityUserRoleCondition.DataArea;
}
if(!cont)
{
txIoWrite.write(strFmt("%1 -- %2 -- %3 -- %4 -- %5 -- %6",userInfo.name,
userInfo.networkAlias,userInfo.company,SecurityUserRole.User, SecurityRole .Name,"ALL"));
}
else
{
txIoWrite.write(strFmt("%1 -- %2 -- %3 -- %4 -- %5 -- %6",userInfo.name,
userInfo.networkAlias,userInfo.company,SecurityUserRole.User, SecurityRole
.Name,con2StrUnlimited(cont, ',')));
}
}
}
No comments:
Post a Comment