[dancer-users] SimpleCRUD question

David Precious davidp at preshweb.co.uk
Mon Feb 3 10:29:26 GMT 2014


On Sun, 2 Feb 2014 11:43:05 +0100
Rene Stoutjesdijk <r.stoutjesdijk at gmail.com> wrote:

> Hi All,
> 
> first let me say that i'm not an experienced dancer user.
> My experience for now is that it really works :).
> 
> I've just started to use the SimpleCRUD plugin, which makes live very
> easy for this kind of actions.
> 
> I do have 2 related questions which i don't know how to resolve:
> 1) can i remove the option to add an entry in the database, as i
> would only want the users to do an edit action (delete was easy to
> remove as it's a configurable parameter).

OTTOMH, I think adding and editing are lumped together at the moment;
I'll see how difficult it would be to add a config parameter to
disallow adding, too.

> 2) can i have somewhere the option to filter (eg by a where clause in
> mysql) based upon the login credentials? I would like to limit the
> table view by a where clause based upon the login name.

Hmm, there's nothing like that, currently, but it may well be possible
to add a hook in the right place that would let you modify the query
about to run, or pass extra criteria to go in the WHERE clause.

What you could do, is use the custom_callbacks option to pass callbacks
to HTML::Table::FromDatabase to modify/skip rows upon output - that'd
be a bit hacky though, as:

 - if you used the download options, you'd get the original data
   unchanged
 - if you were using pagination, filtering out rows at that step would
   throw the pagination out

So, a way to supply additional criteria for the where clause via a hook
may be the way to go.  I'll take a look at that when I have a chance,
but I'm afraid I can't make any guesses as to when that'll be - $work,
and life in general at the moment, is keeping me rather busy!

Cheers

Dave P

-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




More information about the dancer-users mailing list