Results 1 to 3 of 3

Thread: Disable / hide part of the UI according to users roles

  1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    17

    Question Disable / hide part of the UI according to users roles

    Dear all,

    For a project I need to have part of the UI (ie admin section) not shown for non admin user. I also need to have readable only grid fields using a non privileged account while they must be editable using an admin account.

    I came up with the idea of getting the user's object from an ajax request send right after ExtJS is ready. I then use it in the code like this :

    Code:
    if(Application.user.role == 'admin') {
    //set buttons state, column model to editable, and so on
    } else if (Application.user.role == 'moderator') {
    //...
    } else {
    //...
    }
    While I think this is a viable solution I'd be really glad to know if there are better solution then this !

    Edit : seems the way I'm doing was recommended back in 2009 by Condor. Did anything change from then ?

    Thanks.

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    It's what my application is still doing.

    ps. I did consider including the user object as a <script> tag instead of doing a separate XHR request. Saves you some extra coding (but your server needs to return javascript instead of JSON).

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    17

    Default

    Quote Originally Posted by Condor View Post
    It's what my application is still doing.
    Fine, I'll stick with it then. Thanks alot !

Similar Threads

  1. Replies: 4
    Last Post: 23 Oct 2010, 2:37 AM
  2. Users access to some part of the app
    By Radziu in forum Community Discussion
    Replies: 1
    Last Post: 4 Aug 2009, 11:27 PM
  3. can i hide day part of Ext.form.DateField
    By leopku in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 15 Mar 2009, 4:56 AM
  4. How to hide/disable a splitbar?
    By Confused in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 22 Nov 2007, 10:05 PM
  5. Dynamic UI based on Security Roles
    By mdiskin in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 30 Oct 2007, 6:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •