M
M
You have a security collection and an employee collection. The security
collection has a bool for each property of the employee collection, which
states whether or not a particular user has access to each employee property
(i.e., user can see ssNo property, but not salary property).
What sort of design pattern would you use to develop such an app?
Application: on user login, each page has a list of employees, and each
employee has information/properties that the security collection knows the
security setting for. You have to block out salary info for each employee,
but nothing else, for example.
My guess is the following pseudocode, but it looks memory intensive because
for each employee in my employee list, I have to run this loop for the
security check. How can I make sure a security look up is only necessary
once for the whole list of employees?
This is pseudocode:
class empInfo
{
string ssNumber;
decimal hourlyRate;
DateTime dateOfBirth;
securitySetter(empInfo)
{
securityCollection = security.getSecurity(empInfo);
foreach (property prop in empInfo)
{
foreach {securityItem sItem in securityCollection)
{
if (sItem.access(prop))
{
set.prop = "Not accessible";
//or set a code that I can read in the asp.net/forms interface in the
datagrid
}
}
}
return empInfo
}
}
Thanks.!
collection has a bool for each property of the employee collection, which
states whether or not a particular user has access to each employee property
(i.e., user can see ssNo property, but not salary property).
What sort of design pattern would you use to develop such an app?
Application: on user login, each page has a list of employees, and each
employee has information/properties that the security collection knows the
security setting for. You have to block out salary info for each employee,
but nothing else, for example.
My guess is the following pseudocode, but it looks memory intensive because
for each employee in my employee list, I have to run this loop for the
security check. How can I make sure a security look up is only necessary
once for the whole list of employees?
This is pseudocode:
class empInfo
{
string ssNumber;
decimal hourlyRate;
DateTime dateOfBirth;
securitySetter(empInfo)
{
securityCollection = security.getSecurity(empInfo);
foreach (property prop in empInfo)
{
foreach {securityItem sItem in securityCollection)
{
if (sItem.access(prop))
{
set.prop = "Not accessible";
//or set a code that I can read in the asp.net/forms interface in the
datagrid
}
}
}
return empInfo
}
}
Thanks.!