This topic is locked
[SOLVED]

 Security Settings and Groups

2/23/2015 11:37:55 AM
PHPRunner General questions
C
CPSRob author

This is my second post so, again, I apologize if this is blindingly obvious. I have checked the forums and watched the tutorial a number of times. I thought I got it, but perhaps what I want to do is not possible.
The application I am working on is commercial property management application using static security. A User table, which contains userids and passwords, will contain four types of entries (groups). The first group will be Tenants, which can only view and edit their own records. The second group will be Service, which can also only view and edit their own records. The third group will be Management which can view, edit, add, and delete Tenant and Service records, and can edit only their own Management record but not other Management records. The fourth group is Admin that can do everything.
Using Security Settings, I was able to restrict the groups to only edit their own records, but then, in the case of Management, I lost the ability for Management to view Tenant and Service records. Am I missing something or is that not possible. Thanks. Rob

C
CPSRob author 2/26/2015

I changed the application a bit and solved the problem using an Event. This was really more of a problem with a List page, which Tenants and Service groups couldn't use. I was able to solve the problem of Management users being able to List (and therefore View and Edit) their own records but not other Management users or the Admin users by putting in an List Event of type "Before SQL Query" as follows:
// extract the userid and groupid
$userid = $_SESSION["UserID"];

$groupid = $_SESSION["GroupID"];
// If the group is Management, change the WHERE to not display Admin or other Management users but this one.
if ( $groupid == "Management" )

{

$strWhereClause = "(((group = 'Management') AND (userid = '" . $userid .

"')) OR (group = 'Service') OR (group = 'Tenant'))";

}

It seems to work like a champ. Rob