NewMedia42
03-09-04, 11:25 AM
I made a slight change to the modules which allows Company allow/deny rules to affect projects, contacts, etc. You won't want to use this universally (such as calendar), but in other areas it helps to greatly reduce the clutter that happens.
The modification is pretty much the same for most modules, so I'll just use the projects for the example.
1. Open up index.php in the /modules/projects/ folder
2. Search for "deny", you should find:
$obj = new CProject();
$deny = $obj->getDeniedRecords( $AppUI->user_id );
3. Add the following line directly after it:
$Companyobj = new CCompany();
$Companydeny = $Companyobj->getDeniedRecords( $AppUI->user_id );
4. Search for "deny" again, you should find:
.(count($deny) > 0 ? "\nAND project_id NOT IN (" . implode( ',', $deny ) . ')' : '')
5. Add the following line directly after it:
.(count($Companydeny) > 0 ? 'and company_id not in (' . implode( ',', $Companydeny ) . ')' : '')
That's it! Pretty simple cut and paste coding, but you get the general idea.
I hope that in the next version (since permissions appear to be on the work table), that some sort of inheritance is incorporated. For example, if I deny someone from "CompanyA", they shouldn't be able to see ANYTHING from company A, with the only exception as I noted above, in regards to the calendar. Furthermore, if I disallow someone from a particular Project, they shouldn't be able to see Tasks with in it.
Hopefully this helps some others out there that were frustrated with permissions as I was.
The modification is pretty much the same for most modules, so I'll just use the projects for the example.
1. Open up index.php in the /modules/projects/ folder
2. Search for "deny", you should find:
$obj = new CProject();
$deny = $obj->getDeniedRecords( $AppUI->user_id );
3. Add the following line directly after it:
$Companyobj = new CCompany();
$Companydeny = $Companyobj->getDeniedRecords( $AppUI->user_id );
4. Search for "deny" again, you should find:
.(count($deny) > 0 ? "\nAND project_id NOT IN (" . implode( ',', $deny ) . ')' : '')
5. Add the following line directly after it:
.(count($Companydeny) > 0 ? 'and company_id not in (' . implode( ',', $Companydeny ) . ')' : '')
That's it! Pretty simple cut and paste coding, but you get the general idea.
I hope that in the next version (since permissions appear to be on the work table), that some sort of inheritance is incorporated. For example, if I deny someone from "CompanyA", they shouldn't be able to see ANYTHING from company A, with the only exception as I noted above, in regards to the calendar. Furthermore, if I disallow someone from a particular Project, they shouldn't be able to see Tasks with in it.
Hopefully this helps some others out there that were frustrated with permissions as I was.