Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.auth
Class UserPermissions

    java.lang.Object
      org.jdesktop.swingx.auth.UserPermissions

    public class UserPermissions

extends java.lang.Object

This is a singleton that marks the set of permissions for a given logged in user. It is one of the optional results of a successful login operation. The purpose of this class is to provide a central location and client side bridge to the server side permissions and user roles (see J2EE role based authorization). This class is used by gui widgets and actions to determine visibility and enabled status and thus a UI can adapt itself to users with a lower set of privileges. This class is not meant as a secure barrier! It is only a thin layer to supplant the server side permissions. This class can be compromized by the user and thus its purpose is only to help UI flow and navigation and not to prevent attack against a client side UI. A server implementation must ALWAYS recheck permissions sent by the client regardless of the client.

Author:
  Shai Almog

Method Summary
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)`
`void` | `addPropertyChangeListener(java.lang.String name, java.beans.PropertyChangeListener listener)`
`static UserPermissions` | `getInstance()` Returns the singleton instance of this class.
`java.lang.String[]` | `getRoles()` Returns the roles of the currently logged in user
`boolean` | `isUserInARole(java.lang.String[] roles)` Returns true if the user is in one of the given roles (case sensitive).
`boolean` | `isUserInRole(java.lang.String role)` Returns true if the user is in the given role (case sensitive).
`boolean` | `isUserInRoles(java.lang.String[] roles)` Returns true if the user is in all of the given roles (case sensitive).
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)`
`void` | `removePropertyChangeListener(java.lang.String name, java.beans.PropertyChangeListener listener)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

### addPropertyChangeListener

    public void addPropertyChangeListener(java.lang.String name,
                                          java.beans.PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(java.lang.String name,
                                             java.beans.PropertyChangeListener listener)

### getInstance

    public static UserPermissions getInstance()

  Returns the singleton instance of this class. A singleton is used to simplify access for the permissions from every point in the application.

### getRoles

    public java.lang.String[] getRoles()

  Returns the roles of the currently logged in user

### isUserInRole

    public boolean isUserInRole(java.lang.String role)

  Returns true if the user is in the given role (case sensitive).

### isUserInARole

    public boolean isUserInARole(java.lang.String[] roles)

  Returns true if the user is in one of the given roles (case sensitive).

### isUserInRoles

    public boolean isUserInRoles(java.lang.String[] roles)

  Returns true if the user is in all of the given roles (case sensitive).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.