check access before crud events

Questionscheck access before crud events
Wing asked 6 years ago

Before any of the crud events happens, I want to check if the current user has access to do so.
Is there a way to do this?
 
I used general language to show what i’m thinking. is it possible to:

$e[“on_insert”] = array(“add_client”, null, true); 
$e[“on_delete”] = array(“del_client”, null, true); 
$g->set_events($e); 
function add_client($data) 

    global $g; 

    // CHECK IF CURRENT USER HAS ACCESS
    //  IF NO, SHOW ERROR else CONTINUE DEFAULT INSERT
}
function del_client($data) 

    global $g; 

    // CHECK IF CURRENT USER HAS ACCESS
    //  IF NO, SHOW ERROR else CONTINUE DEFAULT DELETE

 
thanks.

1 Answers
Abu Ghufran Staff answered 6 years ago

Yes, that’s the correct way to do it.
Also refer demos/editing/server-validation.php for help.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

16 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?