// Path: app/models/deadbolt/AccessResult.java
// public enum AccessResult
// {
//     ALLOWED,
//     DENIED,
//     NOT_SPECIFIED
// }
// 
// Path: app/models/deadbolt/ExternalizedRestriction.java
// public interface ExternalizedRestriction
// {
//     /**
//      * Gets the role names required to get by this restriction.
//      *
//      * @return the role names
//      */
//     List<String> getRoleNames();
// }
// 
// Path: app/models/deadbolt/ExternalizedRestrictions.java
// public interface ExternalizedRestrictions
// {
//     /**
//      * Gets all the {@link ExternalizedRestriction}s associated with a target.
//      *
//      * @return
//      */
//     List<ExternalizedRestriction> getExternalisedRestrictions();
// }
// 
// Path: app/models/deadbolt/Role.java
// public interface Role
// {
//     /**
//      * The name of the role.
//      *
//      * @return the role name
//      */
//     String getRoleName();
// }
// 
// Path: app/models/deadbolt/RoleHolder.java
// public interface RoleHolder
// {
//     /**
//      * A list of {@link Role}s held by the role holder.
//      *
//      * @return a list of roles
//      */
//     List<? extends Role> getRoles();
// }


import java.util.List;
import java.util.Map;
import models.deadbolt.AccessResult;
import models.deadbolt.ExternalizedRestriction;
import models.deadbolt.ExternalizedRestrictions;
import models.deadbolt.Role;
import models.deadbolt.RoleHolder;
import play.Logger;
import play.Play;
import play.exceptions.ConfigurationException;
import play.mvc.Before;
import play.mvc.Controller;
import play.mvc.Util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
        if (actionUnrestricted == null)
        {
            ExternalRestrictions externalRestrictions = getActionAnnotation(ExternalRestrictions.class);
            if (externalRestrictions == null)
            {
                actionUnrestricted = getControllerAnnotation(Unrestricted.class);
                if (actionUnrestricted == null)
                {
                    externalRestrictions = getControllerInheritedAnnotation(ExternalRestrictions.class);
                }
            }

            if (externalRestrictions != null)
            {
                ExternalizedRestrictionsAccessor externalisedRestrictionsAccessor =
                        DEADBOLT_HANDLER.getExternalizedRestrictionsAccessor();

                boolean roleOk = false;
                if (externalisedRestrictionsAccessor == null)
                {
                    Logger.fatal("@ExternalRestrictions are specified but no ExternalizedRestrictionsAccessor is available.  Denying access to resource.");
                }
                else
                {
                    for (String externalRestrictionTreeName : externalRestrictions.value())
                    {
                        ExternalizedRestrictions externalizedRestrictions =
                                externalisedRestrictionsAccessor.getExternalizedRestrictions(externalRestrictionTreeName);
                        if (externalizedRestrictions != null)
                        {
// Path: app/models/deadbolt/AccessResult.java
// public enum AccessResult
// {
//     ALLOWED,
//     DENIED,
//     NOT_SPECIFIED
// }
// 
// Path: app/models/deadbolt/ExternalizedRestriction.java
// public interface ExternalizedRestriction
// {
//     /**
//      * Gets the role names required to get by this restriction.
//      *
//      * @return the role names
//      */
//     List<String> getRoleNames();
// }
// 
// Path: app/models/deadbolt/ExternalizedRestrictions.java
// public interface ExternalizedRestrictions
// {
//     /**
//      * Gets all the {@link ExternalizedRestriction}s associated with a target.
//      *
//      * @return
//      */
//     List<ExternalizedRestriction> getExternalisedRestrictions();
// }
// 
// Path: app/models/deadbolt/Role.java
// public interface Role
// {
//     /**
//      * The name of the role.
//      *
//      * @return the role name
//      */
//     String getRoleName();
// }
// 
// Path: app/models/deadbolt/RoleHolder.java
// public interface RoleHolder
// {
//     /**
//      * A list of {@link Role}s held by the role holder.
//      *
//      * @return a list of roles
//      */
//     List<? extends Role> getRoles();
// }


// Path: app/controllers/deadbolt/Deadbolt.java
import java.util.List;
import java.util.Map;
import models.deadbolt.AccessResult;
import models.deadbolt.ExternalizedRestriction;
import models.deadbolt.ExternalizedRestrictions;
import models.deadbolt.Role;
import models.deadbolt.RoleHolder;
import play.Logger;
import play.Play;
import play.exceptions.ConfigurationException;
import play.mvc.Before;
import play.mvc.Controller;
import play.mvc.Util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

        if (actionUnrestricted == null)
        {
            ExternalRestrictions externalRestrictions = getActionAnnotation(ExternalRestrictions.class);
            if (externalRestrictions == null)
            {
                actionUnrestricted = getControllerAnnotation(Unrestricted.class);
                if (actionUnrestricted == null)
                {
                    externalRestrictions = getControllerInheritedAnnotation(ExternalRestrictions.class);
                }
            }

            if (externalRestrictions != null)
            {
                ExternalizedRestrictionsAccessor externalisedRestrictionsAccessor =
                        DEADBOLT_HANDLER.getExternalizedRestrictionsAccessor();

                boolean roleOk = false;
                if (externalisedRestrictionsAccessor == null)
                {
                    Logger.fatal("@ExternalRestrictions are specified but no ExternalizedRestrictionsAccessor is available.  Denying access to resource.");
                }
                else
                {
                    for (String externalRestrictionTreeName : externalRestrictions.value())
                    {
                        ExternalizedRestrictions externalizedRestrictions =
                                externalisedRestrictionsAccessor.getExternalizedRestrictions(externalRestrictionTreeName);
                        if (externalizedRestrictions != null)
                        {
                            List<ExternalizedRestriction> restrictions = externalizedRestrictions.getExternalisedRestrictions();