Permission on ralationship

A place for users and developers of the Xataface to discuss and receive support.

Postby siainmi » Thu Aug 09, 2007 4:07 am

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!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Aug 09, 2007 10:16 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby siainmi » Fri Aug 10, 2007 12:48 am

Thank u very much!! It works!!!
P.S. Sorry for my English!!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 33 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved