User Base Security Roles,Duties,Privileges
public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl selectuser;
}
-----------------------------------
public void init()
{
DI_UserSecurity dI_UserSecurities;
Query query;
QueryBuildDataSource qbds;
QueryBuildFieldList qbfl;
query = new Query();
super();
qbds = query.addDataSource(tableNum(UserInfo));
qbds.fields().dynamic(NoYes::Yes);
qbfl = qbds.fields().addField(fieldNum(UserInfo, id));
selectuser = SysLookupMultiSelectCtrl::constructWithQuery(element,UserID,query);
delete_from dI_UserSecurities;
}
-------------------------------------------
void clicked()
{
DI_UserSecurity userSecurity;
SecurityRole securityRole,securityRole1;
SecurityUserRole securityUserRole;
SecurityRoleTaskGrant securityRoleTaskGrant;
SecurityTask securityTask,securityTask1;
securitySubTask securitySubTask;
SecuritysubRole SecuritysubRole;
SysUserInfo sysUserInfo;
int i;
str 100 dutyName;
container con;
Description value;
super();
delete_from userSecurity;
con = selectuser.getSelectedFieldValues();
if(UserId.valueStr() != "")
{
for (i = 1; i <= conLen(con); i++)
{
userSecurity.clear();
value = conPeek(con,i);
while select RecId,Name from securityRole
join User,SecurityRole from securityUserRole
where securityRole.RecId == SecurityUserRole.SecurityRole
&& SecurityUserRole.User == value
{
if(securityRole.RecId)
{
while select SecurityRole,SecurityTask from securityRoleTaskGrant
where securityRoleTaskGrant.SecurityRole == securityRole.RecId
join securityTask
where securityTask.RecId == securityRoleTaskGrant.SecurityTask
&& securityTask.Type == SecurityTaskType::Duty
join SecurityTask,SecuritySubTask from securitySubTask
where securitySubTask.SecurityTask == securityTask.RecId
join securityTask1
where securityTask1.RecId == securitySubTask.SecuritySubTask
{
userSecurity.DI_UserId = value;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
if(userSecurity.DI_Duty == "" && userSecurity.DI_Privilege == "")
{
userSecurity.DI_UserId = value;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
}
}
else
{
while select Id from sysUserInfo
{
if(sysUserInfo.Id)
{
userSecurity.clear();
while select RecId,Name from securityRole
join User,SecurityRole from securityUserRole
where securityRole.RecId == SecurityUserRole.SecurityRole
&& SecurityUserRole.User == sysUserInfo.Id
{
if(securityRole.RecId)
{
while select SecurityRole,SecurityTask from securityRoleTaskGrant
where securityRoleTaskGrant.SecurityRole == securityRole.RecId
join securityTask
where securityTask.RecId == securityRoleTaskGrant.SecurityTask
&& securityTask.Type == SecurityTaskType::Duty
join SecurityTask,SecuritySubTask from securitySubTask
where securitySubTask.SecurityTask == securityTask.RecId
join securityTask1
where securityTask1.RecId == securitySubTask.SecuritySubTask
{
userSecurity.DI_UserId = sysUserInfo.Id;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
if(userSecurity.DI_Duty == "" && userSecurity.DI_Privilege == "")
{
userSecurity.DI_UserId = sysUserInfo.Id;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
}
}
}
DI_UserSecurity_ds.research();
}
public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl selectuser;
}
-----------------------------------
public void init()
{
DI_UserSecurity dI_UserSecurities;
Query query;
QueryBuildDataSource qbds;
QueryBuildFieldList qbfl;
query = new Query();
super();
qbds = query.addDataSource(tableNum(UserInfo));
qbds.fields().dynamic(NoYes::Yes);
qbfl = qbds.fields().addField(fieldNum(UserInfo, id));
selectuser = SysLookupMultiSelectCtrl::constructWithQuery(element,UserID,query);
delete_from dI_UserSecurities;
}
-------------------------------------------
void clicked()
{
DI_UserSecurity userSecurity;
SecurityRole securityRole,securityRole1;
SecurityUserRole securityUserRole;
SecurityRoleTaskGrant securityRoleTaskGrant;
SecurityTask securityTask,securityTask1;
securitySubTask securitySubTask;
SecuritysubRole SecuritysubRole;
SysUserInfo sysUserInfo;
int i;
str 100 dutyName;
container con;
Description value;
super();
delete_from userSecurity;
con = selectuser.getSelectedFieldValues();
if(UserId.valueStr() != "")
{
for (i = 1; i <= conLen(con); i++)
{
userSecurity.clear();
value = conPeek(con,i);
while select RecId,Name from securityRole
join User,SecurityRole from securityUserRole
where securityRole.RecId == SecurityUserRole.SecurityRole
&& SecurityUserRole.User == value
{
if(securityRole.RecId)
{
while select SecurityRole,SecurityTask from securityRoleTaskGrant
where securityRoleTaskGrant.SecurityRole == securityRole.RecId
join securityTask
where securityTask.RecId == securityRoleTaskGrant.SecurityTask
&& securityTask.Type == SecurityTaskType::Duty
join SecurityTask,SecuritySubTask from securitySubTask
where securitySubTask.SecurityTask == securityTask.RecId
join securityTask1
where securityTask1.RecId == securitySubTask.SecuritySubTask
{
userSecurity.DI_UserId = value;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
if(userSecurity.DI_Duty == "" && userSecurity.DI_Privilege == "")
{
userSecurity.DI_UserId = value;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
}
}
else
{
while select Id from sysUserInfo
{
if(sysUserInfo.Id)
{
userSecurity.clear();
while select RecId,Name from securityRole
join User,SecurityRole from securityUserRole
where securityRole.RecId == SecurityUserRole.SecurityRole
&& SecurityUserRole.User == sysUserInfo.Id
{
if(securityRole.RecId)
{
while select SecurityRole,SecurityTask from securityRoleTaskGrant
where securityRoleTaskGrant.SecurityRole == securityRole.RecId
join securityTask
where securityTask.RecId == securityRoleTaskGrant.SecurityTask
&& securityTask.Type == SecurityTaskType::Duty
join SecurityTask,SecuritySubTask from securitySubTask
where securitySubTask.SecurityTask == securityTask.RecId
join securityTask1
where securityTask1.RecId == securitySubTask.SecuritySubTask
{
userSecurity.DI_UserId = sysUserInfo.Id;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
if(userSecurity.DI_Duty == "" && userSecurity.DI_Privilege == "")
{
userSecurity.DI_UserId = sysUserInfo.Id;
userSecurity.DI_Role = securityRole.Name;
userSecurity.DI_Duty = SysLabel::labelId2String(securityTask.Name);
userSecurity.DI_Privilege = SysLabel::labelId2String(securityTask1.Name);
userSecurity.insert();
}
}
}
}
}
DI_UserSecurity_ds.research();
}
No comments:
Post a Comment