PK z=j > > commands.py# Here you can create play commands that are specific to the module, and extend existing commands
MODULE = 'deadbolt'
# Commands that are specific to your module
COMMANDS = ['deadbolt:hello']
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == "deadbolt:hello":
print "~ Hello"
# This will be executed before any command (new, run...)
def before(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
# This will be executed after any command (new, run...)
def after(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == "new":
pass
PK z=(u u build.xml
PK `I=ssg0 0 commands.pyc
OMc @ s. d Z d g Z d Z d Z d Z d S( t deadbolts deadbolt:helloc K sV | i d } | i d } | i d } | i d } | d j o d GHn d S( Nt commandt appt argst envs deadbolt:hellos ~ Hello( t get( t kargsR R R R ( ( s* /home/steve/objectify/deadbolt/commands.pyt execute s
c K s@ | i d } | i d } | i d } | i d } d S( NR R R R ( R ( R R R R R ( ( s* /home/steve/objectify/deadbolt/commands.pyt before s c K sQ | i d } | i d } | i d } | i d } | d j o n d S( NR R R R t new( R ( R R R R R ( ( s* /home/steve/objectify/deadbolt/commands.pyt after s
N( t MODULEt COMMANDSR R R
( ( ( s* /home/steve/objectify/deadbolt/commands.pyt s PK WjB>,O/ README.textileh1. Deadbolt
Deadbolt is an authorisation mechanism for defining access rights to certain controller methods or parts of a view using a simple AND/OR/NOT syntax. It is based on the original Secure module that comes with the Play! framework.
Note that Deadbolt doesn't provide authentication! You can still use the existing Secure module alongside Deadbolt to provide authentication, and in cases where authentication is handled outside your app you can just hook up the authorisation mechanism to whatever auth system is used.
h3. Getting started
To installl Deadbolt, you can use the modules repository:
bc. play install deadbolt-
h3. Examples
Check the samples-and-tests folder for examples of all the code required below.
h3. Identifying the current user
In order to know if access to a view or controller is authorised, you need to know who the current user is. Because various applications will have their own concept of a user, Deadbolt defines the models.deadbolt.RoleHolder interface. This interface should be implemented by any class type that represents an object that will try to access a controller method or view.
bc. package models;
import models.deadbolt.Role;
import models.deadbolt.RoleHolder;
import java.util.Arrays;
import java.util.List;
public class MyRoleHolder implements RoleHolder
{
public List extends Role> getRoles()
{
return Arrays.asList(new MyRole("foo"),
new MyRole("bar"),
new MyRole("restricted"));
}
}
Once a RoleHolder has been implemented, it can return a list of models.deadbolt.Role objects to indicate which roles a RoleHolder has. Again, Role is an interface and so should not intrude on your application's model architecture.
bc. package models;
import models.deadbolt.Role;
public class MyRole implements Role
{
private String name;
public MyRole(String name)
{
this.name = name;
}
public String getRoleName()
{
return name;
}
}
In a move taken directly from the Secure module, you define the hooks into your application by extending a static inner class of Deadbolt - DeadboltHandler. This class has two key methods -
bc. static RoleHolder getRoleHolder()
getRoleHolder() should return the current user, which must implement the models.deadbolt.RoleHolder interface.
bc. static void onAccessFailure(String controllerClassName)
onAccessFailure(String) should handle the what happens following an unauthorised attempt to access a secured controller method.
A further method, getExternalizedRestrictionsAccessor() can be implemented if you are supported externalised restriction trees.
h3. Securing controllers
Controllers are secured using the @With annotation to ensure method calls are checked against the current user.
bc. @With(Deadbolt.class)
public class MyController extends Controller
Rolenames are matched against result of the Role.getRoleName() method of the roles return from RoleHolder#getRoles().
There are two annotations available to define access to a controller method - @Restrict, and @Restrictions.
h3. @Restrict
The @Restrict annotation defines a set of role names that are ANDed together.
bc. // This restricts access to the list method to any role holder with a role whose name is "foo"
@Restrict("foo")
public static void list()
bc. // This restricts access to the list method to any role holder with both "foo" and a "bar" roles.
@Restrict({"foo", "bar"})
public static void list()
h3. @Restrictions
The @Restrictions annotation defines a set of @Restricts that are ORed together.
bc. // This restricts access to the list method to any role holder with a role whose name is "foo". This is the equivalent to just @Restrict("foo")
@Restrictions(@Restrict("foo"))
public static void list()
bc. // This restricts access to the list method to any role holder with the "foo" role, or roles whose names are "bar" AND "gee". Note that a role holder with a "bar" OR a "gee" role will be denied access.
@Restrictions({@Restrict("foo"), @Restrict({"bar", "gee"})})
public static void list()
h3. Securing views
Views are secured with the deadbolt.restrict tag. This is slightly simpler than the annotations used by controllers, since the syntax is always that of @Restrictions, i.e. ORed role groups in the top level, ANDed roles groups in the inner level:
bc. #{deadbolt.restrict roles:[['foo']]}
this restricts access to this content to role holders with the "foo" role
#{/deadbolt.restrict}
bc. #{deadbolt.restrict roles:[['foo', 'bar']]}
this restricts access to this content to role holders with the "foo" AND 'bar' roles
#{/deadbolt.restrict}
bc. #{deadbolt.restrict roles:[['foo'], ['bar']]}
this restricts access to this content to role holders with the "foo" OR 'bar' role
#{/deadbolt.restrict}
h3. Negating role names
By prefixing a rolename with ! you state the method or view is inaccessible to any role holder with that role.
bc. This restricts access to the list method to any role holder with a "foo" role but no "bar" role. If a "bar" role is present, access is denied.
@Restrict({"foo", "!bar"})
public static void list()
The same applies in views:
bc. This restricts view rendering for the content to any role holder with a "foo" role but no "bar" role. If a "bar" role is present, rendering is skipped.
#{deadbolt.restrict roles:[['foo', '!bar']]}
...
#{/deadbolt.restrict}
h3. Combining regular and negated role names in views
By nesting regular and negated role names in a view, you can have very fine-grained control over what is displayed. For example,
bc. #{deadbolt.restrict roles:[['foo', 'bar', 'gee']]}
something
#{deadbolt.restrict roles:[['!bar']]}
something only visible to role holders who aren't "bar"s
#{/deadbolt.restrict}
something else
#{/deadbolt.restrict}
h3. Externalised restrictions
Deadbolt allows you to annotation controller classes and methods with named restriction trees.
bc. @ExternalRestrictions("admin-only")
public static void edit()
bc. @ExternalRestrictions({"admin", "super-mega-admin"})
public static void edit()
This annotation maps to an externalised restriction - again a combination of ANDs, ORs and NOTs - and so allows you to
define standard security schemes than can be changed at the e.g. database level.
Each name passed to the annotation, e.g. admin and super-mega-admin in the example above, maps to an ExternalizedRestrictions
instance. The results of these instances are OR'd together. Each ExternalizedRestrictions instance has a list of ExternalizedRestriction
instances - each of these instances is also OR'd together. Finally, each ExternalizedRestriction has a list of role names - these are ANDed together, and also support role name
negation.
Below is an example implementation of an ExternalizedRestrictionsAccessor.
bc. import controllers.deadbolt.ExternalizedRestrictionsAccessor;
import models.deadbolt.ExternalizedRestrictions;
import java.util.HashMap;
import java.util.Map;
public class MyExternalizedRestrictionsAccessor implements ExternalizedRestrictionsAccessor
{
private final Map restrictions = new HashMap();
public MyExternalizedRestrictionsAccessor()
{
restrictions.put("standard",
new MyExternalizedRestrictions(new MyExternalizedRestriction("foo"),
new MyExternalizedRestriction("bar")));
restrictions.put("one-role-missing",
new MyExternalizedRestrictions(new MyExternalizedRestriction("foo"),
new MyExternalizedRestriction("rab")));
restrictions.put("admin",
new MyExternalizedRestrictions(new MyExternalizedRestriction("admin")));
restrictions.put("exclude-restricted",
new MyExternalizedRestrictions(new MyExternalizedRestriction("!restricted")));
}
public ExternalizedRestrictions getExternalizedRestrictions(String name)
{
return restrictions.get(name);
}
}
h3. Mixing annotations
The annotations detailed above can be applied in combination to controller classes and fields. The evaluation is ANDed and the order is
* Restrict
* Restrictions
* ExternalRestrictionsPK =7% % LICENSE.txt Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.PK lB>-$ $ manifestversion=1.0.1
frameworkVersions=1.1
PK RE= src/play.pluginsPK WjB>,O/ ! documentation/manual/home.textileh1. Deadbolt
Deadbolt is an authorisation mechanism for defining access rights to certain controller methods or parts of a view using a simple AND/OR/NOT syntax. It is based on the original Secure module that comes with the Play! framework.
Note that Deadbolt doesn't provide authentication! You can still use the existing Secure module alongside Deadbolt to provide authentication, and in cases where authentication is handled outside your app you can just hook up the authorisation mechanism to whatever auth system is used.
h3. Getting started
To installl Deadbolt, you can use the modules repository:
bc. play install deadbolt-
h3. Examples
Check the samples-and-tests folder for examples of all the code required below.
h3. Identifying the current user
In order to know if access to a view or controller is authorised, you need to know who the current user is. Because various applications will have their own concept of a user, Deadbolt defines the models.deadbolt.RoleHolder interface. This interface should be implemented by any class type that represents an object that will try to access a controller method or view.
bc. package models;
import models.deadbolt.Role;
import models.deadbolt.RoleHolder;
import java.util.Arrays;
import java.util.List;
public class MyRoleHolder implements RoleHolder
{
public List extends Role> getRoles()
{
return Arrays.asList(new MyRole("foo"),
new MyRole("bar"),
new MyRole("restricted"));
}
}
Once a RoleHolder has been implemented, it can return a list of models.deadbolt.Role objects to indicate which roles a RoleHolder has. Again, Role is an interface and so should not intrude on your application's model architecture.
bc. package models;
import models.deadbolt.Role;
public class MyRole implements Role
{
private String name;
public MyRole(String name)
{
this.name = name;
}
public String getRoleName()
{
return name;
}
}
In a move taken directly from the Secure module, you define the hooks into your application by extending a static inner class of Deadbolt - DeadboltHandler. This class has two key methods -
bc. static RoleHolder getRoleHolder()
getRoleHolder() should return the current user, which must implement the models.deadbolt.RoleHolder interface.
bc. static void onAccessFailure(String controllerClassName)
onAccessFailure(String) should handle the what happens following an unauthorised attempt to access a secured controller method.
A further method, getExternalizedRestrictionsAccessor() can be implemented if you are supported externalised restriction trees.
h3. Securing controllers
Controllers are secured using the @With annotation to ensure method calls are checked against the current user.
bc. @With(Deadbolt.class)
public class MyController extends Controller
Rolenames are matched against result of the Role.getRoleName() method of the roles return from RoleHolder#getRoles().
There are two annotations available to define access to a controller method - @Restrict, and @Restrictions.
h3. @Restrict
The @Restrict annotation defines a set of role names that are ANDed together.
bc. // This restricts access to the list method to any role holder with a role whose name is "foo"
@Restrict("foo")
public static void list()
bc. // This restricts access to the list method to any role holder with both "foo" and a "bar" roles.
@Restrict({"foo", "bar"})
public static void list()
h3. @Restrictions
The @Restrictions annotation defines a set of @Restricts that are ORed together.
bc. // This restricts access to the list method to any role holder with a role whose name is "foo". This is the equivalent to just @Restrict("foo")
@Restrictions(@Restrict("foo"))
public static void list()
bc. // This restricts access to the list method to any role holder with the "foo" role, or roles whose names are "bar" AND "gee". Note that a role holder with a "bar" OR a "gee" role will be denied access.
@Restrictions({@Restrict("foo"), @Restrict({"bar", "gee"})})
public static void list()
h3. Securing views
Views are secured with the deadbolt.restrict tag. This is slightly simpler than the annotations used by controllers, since the syntax is always that of @Restrictions, i.e. ORed role groups in the top level, ANDed roles groups in the inner level:
bc. #{deadbolt.restrict roles:[['foo']]}
this restricts access to this content to role holders with the "foo" role
#{/deadbolt.restrict}
bc. #{deadbolt.restrict roles:[['foo', 'bar']]}
this restricts access to this content to role holders with the "foo" AND 'bar' roles
#{/deadbolt.restrict}
bc. #{deadbolt.restrict roles:[['foo'], ['bar']]}
this restricts access to this content to role holders with the "foo" OR 'bar' role
#{/deadbolt.restrict}
h3. Negating role names
By prefixing a rolename with ! you state the method or view is inaccessible to any role holder with that role.
bc. This restricts access to the list method to any role holder with a "foo" role but no "bar" role. If a "bar" role is present, access is denied.
@Restrict({"foo", "!bar"})
public static void list()
The same applies in views:
bc. This restricts view rendering for the content to any role holder with a "foo" role but no "bar" role. If a "bar" role is present, rendering is skipped.
#{deadbolt.restrict roles:[['foo', '!bar']]}
...
#{/deadbolt.restrict}
h3. Combining regular and negated role names in views
By nesting regular and negated role names in a view, you can have very fine-grained control over what is displayed. For example,
bc. #{deadbolt.restrict roles:[['foo', 'bar', 'gee']]}
something
#{deadbolt.restrict roles:[['!bar']]}
something only visible to role holders who aren't "bar"s
#{/deadbolt.restrict}
something else
#{/deadbolt.restrict}
h3. Externalised restrictions
Deadbolt allows you to annotation controller classes and methods with named restriction trees.
bc. @ExternalRestrictions("admin-only")
public static void edit()
bc. @ExternalRestrictions({"admin", "super-mega-admin"})
public static void edit()
This annotation maps to an externalised restriction - again a combination of ANDs, ORs and NOTs - and so allows you to
define standard security schemes than can be changed at the e.g. database level.
Each name passed to the annotation, e.g. admin and super-mega-admin in the example above, maps to an ExternalizedRestrictions
instance. The results of these instances are OR'd together. Each ExternalizedRestrictions instance has a list of ExternalizedRestriction
instances - each of these instances is also OR'd together. Finally, each ExternalizedRestriction has a list of role names - these are ANDed together, and also support role name
negation.
Below is an example implementation of an ExternalizedRestrictionsAccessor.
bc. import controllers.deadbolt.ExternalizedRestrictionsAccessor;
import models.deadbolt.ExternalizedRestrictions;
import java.util.HashMap;
import java.util.Map;
public class MyExternalizedRestrictionsAccessor implements ExternalizedRestrictionsAccessor
{
private final Map restrictions = new HashMap();
public MyExternalizedRestrictionsAccessor()
{
restrictions.put("standard",
new MyExternalizedRestrictions(new MyExternalizedRestriction("foo"),
new MyExternalizedRestriction("bar")));
restrictions.put("one-role-missing",
new MyExternalizedRestrictions(new MyExternalizedRestriction("foo"),
new MyExternalizedRestriction("rab")));
restrictions.put("admin",
new MyExternalizedRestrictions(new MyExternalizedRestriction("admin")));
restrictions.put("exclude-restricted",
new MyExternalizedRestrictions(new MyExternalizedRestriction("!restricted")));
}
public ExternalizedRestrictions getExternalizedRestrictions(String name)
{
return restrictions.get(name);
}
}
h3. Mixing annotations
The annotations detailed above can be applied in combination to controller classes and fields. The evaluation is ANDed and the order is
* Restrict
* Restrictions
* ExternalRestrictionsPK 7=(2 % app/views/tags/deadbolt/restrict.html%{
boolean allowAccess = false;
for (int i = 0; !allowAccess && i < _roles.size; i++)
{
allowAccess = controllers.deadbolt.Deadbolt.hasRoles(_roles.get(i))
}
}%
#{if allowAccess}
#{doBody /}
#{/if}PK κ=[i i * app/controllers/deadbolt/Restrictions.java/*
* Copyright 2009-2010 Steve Chaloner
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package controllers.deadbolt;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifies access to a controller class or controller method based on roles.
*
* @author Steve Chaloner (steve@objectify.be).
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
public @interface Restrictions
{
Restrict[] value();
}
PK R=Dl > app/controllers/deadbolt/ExternalizedRestrictionsAccessor.javapackage controllers.deadbolt;
import models.deadbolt.ExternalizedRestrictions;
/**
* @author Steve Chaloner (steve@objectify.be).
*/
public interface ExternalizedRestrictionsAccessor
{
ExternalizedRestrictions getExternalizedRestrictions(String name);
}
PK =@ϐ( ( 2 app/controllers/deadbolt/ExternalRestrictions.java/*
* Copyright 2009-2010 Steve Chaloner
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package controllers.deadbolt;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifies access to a controller class or controller method based on a pre-defined restriction tree from an external
* source, e.g. a database.
*
* @author Steve Chaloner (steve@objectify.be).
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
public @interface ExternalRestrictions
{
/**
* The names of the restriction trees.
*
* @return the names of the restriction trees
*/
String[] value();
}
PK !kB>MܢJe$ e$ &