How to hide "Also delete record(s) from database?" message?

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

How to hide "Also delete record(s) from database?" message?

Postby FractalizeR » Wed Oct 26, 2011 2:56 am

When I try to remove rows from relation, Xataface asks
"Also delete record(s) from database?"
- what does this question mean? As I can see, without checking it, record gets deleted well.
And how to hide it?
FractalizeR
 
Posts: 19
Joined: Tue Oct 04, 2011 5:26 am

Re: How to hide "Also delete record(s) from database?" messa

Postby ADobkin » Wed Oct 26, 2011 4:40 am

By default, removing records from a relationship only makes it so the records are no longer related. The original records should still exist.

For example, with a cities table and countries table, I might accidentally create a relationship by adding London to France. To correct it, I would remove the relationship, but I would still want London to exist. However, if this were a city that needed to be deleted completely, then I would want to also select the option to delete the record from the database.

If you don't want this message to appear, one method I can think of would be to revoke the delete permission. I'm sure there are other ways to do it if that doesn't meet your needs.
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: How to hide "Also delete record(s) from database?" messa

Postby FractalizeR » Wed Oct 26, 2011 5:58 am

ADobkin wrote:If you don't want this message to appear, one method I can think of would be to revoke the delete permission. I'm sure there are other ways to do it if that doesn't meet your needs.

How to do that? I've added the following to the table class, but this message still appears. I have user, country, and user_country tables in this relation.

Code: Select all
class tables_country {
    function getPermissions(&$record) {
        return Dataface_PermissionsTool::READ_ONLY();
    }
}
FractalizeR
 
Posts: 19
Joined: Tue Oct 04, 2011 5:26 am

Re: How to hide "Also delete record(s) from database?" messa

Postby ADobkin » Wed Oct 26, 2011 6:21 am

This wiki page explains it in detail:

http://xataface.com/wiki/Relationship_Permissions
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: How to hide "Also delete record(s) from database?" messa

Postby FractalizeR » Wed Oct 26, 2011 6:45 am

Thanks, but this page contains permission fine-tuning only for relation itself.

It seems, that setting permission on the table, which is a relation participant, should really revoke delete permission from it, but somehow that message still appears for me despite providing tables_country::getPermissions() method.
FractalizeR
 
Posts: 19
Joined: Tue Oct 04, 2011 5:26 am

Re: How to hide "Also delete record(s) from database?" messa

Postby ADobkin » Wed Oct 26, 2011 7:01 am

Perhaps the "delete related record" permission is granted somewhere in your application:

Permission to delete a related record. This allows both removing the related record from the relationship, and deleting the record from the database. This permission is not included in any default roles. A combination of permission for remove related record? in the source table and delete? in the target table, are equivalent to access to this permission. Use this permission only when you need to override the ability to delete records from the database based on membership in a relationship.


Since this permission is not normally included by default, maybe you have ALL() permissions defined somewhere.

Incidentally, I do not normally see this message in my applications when removing related records, and the original record is not deleted. So it sounds like you have customized something somewhere that is triggering it.
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: How to hide "Also delete record(s) from database?" messa

Postby FractalizeR » Wed Oct 26, 2011 7:21 am

Can I show you my config by email? I don't see any permissions override since I don't use permission system at all.

I have only a call

Code: Select all
class tables_user_log {
    function getPermissions(&$record) {
        return Dataface_PermissionsTool::READ_ONLY();
    }


But that's another table. And permission is READ_ONLY, not ALL.
FractalizeR
 
Posts: 19
Joined: Tue Oct 04, 2011 5:26 am

Re: How to hide "Also delete record(s) from database?" messa

Postby ADobkin » Wed Oct 26, 2011 7:49 am

Sure, I can look at it for you. I will send you a PM with my contact info.

BTW, I need to correct my earlier statement. I do also see this message when logged in as an admin user. According to the code in RemoveRelatedRecordForm.php, it checks for two permissions:

// We are allowed to delete the records if for each record in the 
// set, we have either:
// 1. Delete permission on the domain record.
// 2. delete related record permission on the parent record


So, if you revoke delete permission on the parent record/table by setting READ ONLY (as it seems you have), that should suppress this option. I could do some testing in my application to verify this.
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: How to hide "Also delete record(s) from database?" messa

Postby FractalizeR » Wed Oct 26, 2011 8:01 am

I've sent you my project. And yes, I login as admin user it seems because... I don't login at all ;) Xataface seem to set admin user priviledges by default, if application doesn't use permission system.

Thanks in advance.
FractalizeR
 
Posts: 19
Joined: Tue Oct 04, 2011 5:26 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 3 guests

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