Password protect the edit possibility ?

QuestionsPassword protect the edit possibility ?
Davy asked 11 years ago

Hello all,

I was wondering whether I can password protect the edit possibility of a line in the grid ?

We would like that everybody can SEE the full grid with values but edit should only be possible after entering userid and password (which could come from a user table).

Any possibility for this ?

Thanks very much in advance,

Davy

3 Answers
Abu Ghufran answered 11 years ago

Grid is an independent lib. You need to implement the authentication system byself.
However, you can put conditional session variable checks on set_action() function to make it editable if authenticated, otherwise not.

Davy answered 11 years ago

Hey Abu,

may I be so blunt to ask if I can find an example of this somewhere ? I have already worked with the set_action before (for opening another screen when pushing a button) but how could I tell the button to simply do what normally the edit button does (after checking security then).

Greetings and thanks in advance,

Davy

Abu Ghufran answered 11 years ago

Assume your authenticated session have session var … logged_in

if ($_SESSION["logged_in"] == 1)
{
$edit = true;
}
else
{
$edit = false;
}

and now for e.g.

$g->set_actions(array(
"add"=>true, // allow/disallow add
"edit"=>$edit, // allow/disallow edit
"delete"=>true, // allow/disallow delete
)
);

Your Answer

14 + 3 =

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?