Javolution 6.0.0 java
javolution.context.SecurityContext.Permission< T > Class Template Reference
Collaboration diagram for javolution.context.SecurityContext.Permission< T >:
[legend]

Public Member Functions

 Permission (Class<? super T > category)
 
 Permission (Class<? super T > category, String action)
 
 Permission (Class<? super T > category, String action, T instance)
 
Class<? super T > getCategory ()
 
String getAction ()
 
getInstance ()
 
boolean implies (Permission<?> that)
 
String toString ()
 
boolean equals (Object obj)
 
int hashCode ()
 

Static Public Attributes

static final Permission< Object > ALL
 

Private Attributes

final Class<? super T > category
 
final String action
 
final T instance
 

Detailed Description

A permission associated to a specific class/action/instance. There are three levels of permission possible, at the class/category level, at the action level and at the instance level. Any permission granted/revoked at the higher level is explicitly granted/revoked at the lower level. The order in which the permission are granted/revoked is important. For example, it is possible to grant a permission at the class level, then to revoke it at the action or instance level. In which case, for that class the permission is granted for all actions/instances except for those actions/instances for which the permission has been explicitly revoked.

Definition at line 48 of file SecurityContext.java.

Constructor & Destructor Documentation

◆ Permission() [1/3]

javolution.context.SecurityContext.Permission< T >.Permission ( Class<? super T >  category)

Creates a security permission for all actions of the specified category.

Definition at line 65 of file SecurityContext.java.

65  {
66  this(category, null, null);
67  }

◆ Permission() [2/3]

javolution.context.SecurityContext.Permission< T >.Permission ( Class<? super T >  category,
String  action 
)

Creates a security permission for the specified action of the specified category.

Definition at line 73 of file SecurityContext.java.

73  {
74  this(category, action, null);
75  }

◆ Permission() [3/3]

javolution.context.SecurityContext.Permission< T >.Permission ( Class<? super T >  category,
String  action,
instance 
)

Creates a security permission for the specified instance and the specified action of the specified category.

Definition at line 81 of file SecurityContext.java.

81  {
82  this.category = category;
83  this.action = action;
84  this.instance = instance;
85  }

Member Function Documentation

◆ equals()

boolean javolution.context.SecurityContext.Permission< T >.equals ( Object  obj)

Definition at line 146 of file SecurityContext.java.

146  {
147  if (obj == this)
148  return true;
149  if (!(obj instanceof Permission))
150  return false;
151  Permission<?> that = (Permission<?>) obj;
152  if ((category == null) && (that.category != null))
153  return false;
154  if ((category != null) && (!category.equals(that.category)))
155  return false;
156  if ((action == null) && (that.action != null))
157  return false;
158  if ((action != null) && (!action.equals(that.action)))
159  return false;
160  if ((instance == null) && (that.instance != null))
161  return false;
162  if ((instance != null) && (!instance.equals(that.instance)))
163  return false;
164  return false;
165  }

◆ getAction()

Returns the permission action or null for all actions.

Definition at line 97 of file SecurityContext.java.

97  {
98  return action;
99  }

◆ getCategory()

Class<? super T> javolution.context.SecurityContext.Permission< T >.getCategory ( )

Returns the permission category or null for all categories.

Definition at line 90 of file SecurityContext.java.

90  {
91  return category;
92  }

◆ getInstance()

Returns the permission instance or null for all instances.

Definition at line 104 of file SecurityContext.java.

104  {
105  return instance;
106  }

◆ hashCode()

Definition at line 168 of file SecurityContext.java.

168  {
169  return (category != null ? category.hashCode() : 0)
170  + (action != null ? action.hashCode() : 0)
171  + (instance != null ? instance.hashCode() : 0);
172  }

◆ implies()

boolean javolution.context.SecurityContext.Permission< T >.implies ( Permission<?>  that)

Checks if the specified permission is automatically granted/revoked by 'this' permission being granted/revoked.

Parameters
thatthe permission to check.
Returns
true if this permission being granted/revoked implies that the specified permission is granted/revoked; false otherwise.

Definition at line 117 of file SecurityContext.java.

117  {
118  if (category == null)
119  return true;
120  if (!category.isAssignableFrom(that.category))
121  return false;
122  if (action == null)
123  return true;
124  if (!action.equals(that.action))
125  return false;
126  if (instance == null)
127  return true;
128  if (!instance.equals(that.instance))
129  return false;
130  return true;
131  }

◆ toString()

Definition at line 134 of file SecurityContext.java.

134  {
135  if (category == null)
136  return "All permissions";
137  if (action == null)
138  return "Permission for any action on " + category.getName();
139  if (instance == null)
140  return "Permission for " + action + " on " + category.getName();
141  return "Permission for " + action + " on instance " + instance
142  + " of " + category.getName();
143  }

Member Data Documentation

◆ action

◆ ALL

Initial value:
= new Permission<Object>(
null)

Holds the global permission for anything.

Definition at line 53 of file SecurityContext.java.

◆ category

◆ instance


The documentation for this class was generated from the following file:
javolution.context.SecurityContext.Permission.category
final Class<? super T > category
Definition: SecurityContext.java:56
javolution.context.SecurityContext.Permission.action
final String action
Definition: SecurityContext.java:58
javolution.context.SecurityContext.Permission.instance
final T instance
Definition: SecurityContext.java:60
javolution.context.SecurityContext.Permission<?>
javolution.context.SecurityContext.Permission.Permission
Permission(Class<? super T > category)
Definition: SecurityContext.java:65