Page 1 of 1

PostPosted: Thu Aug 09, 2007 4:07 am
by siainmi
It's possible to set differt permission from first table on relationship.
E.g. on first Table User can edit, but on relation User can only view!

PostPosted: Thu Aug 09, 2007 10:16 am
by shannah

Hi,

Yes, this is possible.Ê If you want all relationships for a record to have the same permissions, then you can achieve this by NOT allowing the following permissions:
add new related record
add existing related record
remove related record
delete related record
One way to achieve this is by adding a permissions.ini file to your application's directory, and create a role that inherits from ADMIN but disallows these permissions.Ê e.g.
[MY_ROLE extends ADMIN]
add new related record=0
add existing related record=0
remove related record=0
delete related record=0
Then in your getPermissions() method you would just return the permissions for this role:
function getPermissions(&$record){
ÊÊÊ return Dataface_PermissionsTool::getRolePermissions('MY_ROLE');
}

If you want these permissions to only apply to a particular relationship then you could assign the permissions inside the method:
rel_%%RELATIONSHIP_NAME%%__permissions()
e.g. If the relationship is named foo, you could do:
function rel_foo__permissions(&$record){
ÊÊÊÊ return Dataface_PermissionsTool::getRolePermissions('MY_ROLE');
}

Note that you would also want to set the permissions on the related table to disallow editing of those related records.
-Steve

PostPosted: Fri Aug 10, 2007 12:48 am
by siainmi
Thank u very much!! It works!!!
P.S. Sorry for my English!!