DMXzone Security Provider PHP Support Product Page

Answered

Hide add and delete buttons

Asked 17 Jan 2014 14:50:35
1
has this question
17 Jan 2014 14:50:35 Gianmario Colciago posted:
I have two users: admin and guest.
The admin user can add and edit the data in the database.
The guest instead has read only access.

In my application I want to hide the add button and the delete button when the guest logs.

How can I do it with Security Provider?

Thanks

Replies

Replied 17 Jan 2014 15:11:39
17 Jan 2014 15:11:39 Teodor Kuduschiev replied:
Replied 17 Jan 2014 17:36:29
17 Jan 2014 17:36:29 Gianmario Colciago replied:
Hello.
I do not need the data filtering.
Both users (ADMIN and GUEST) see the same data.

The first one, however, MUST SEE the two buttons ADD and EDIT.
The second one MUST NOT SEE the two buttons.

The video was useful for other solutions, not for this.
Do you have a different suggestion?
Thanks.
Replied 17 Jan 2014 18:16:47
17 Jan 2014 18:16:47 Teodor Kuduschiev replied:
Just wrap the two buttons into a container and using the Data Bindings formatter change its class depending on the user identity.
So if
@useridentity = 1 / class = hidden
@useridentity = 2 / class = visible

You can just style the classes to set display:none/block
Replied 17 Jan 2014 20:11:16
17 Jan 2014 20:11:16 Gianmario Colciago replied:
Thank you, Teodor, for your reply.
I got the answer that solved the problem.
I used the Data Bindings Formatter to change class depending on the user identity. Below the code.
Your extensions are powerful. Bravo!

     <span class="{{$SECURITY.identity.contains( "GUEST" ).then( "HIDDENCLASS", "VISIBLECLASS" )}}"> 
     <a href="#" class="btn btn-info" style="margin-right:20px;"> ADD </ a> 
         </ span> 
     </ li>


Thanks.

Reply to this topic