// Path: app/controllers/deadbolt/RestrictedResourcesHandler.java
// public interface RestrictedResourcesHandler
// {
//     /**
//      * Check the access of someone, typically the current user, for the named resource.
//      *
//      * <ul>
//      * <li>If {@link AccessResult#NOT_SPECIFIED} is returned and
//      * {@link controllers.deadbolt.RestrictedResource#staticFallback()} is false, access is denied.</li>
//      * <li>If {@link AccessResult#NOT_SPECIFIED} is returned and
//      * {@link controllers.deadbolt.RestrictedResource#staticFallback()} is true, any further Restrict or
//      * Restrictions annotations are processed.  Note that if no Restrict or Restrictions annotations are present,
//      * access will be allowed.</li>
//      * </ul>
//      *
//      * @param resourceNames the names of the resource
//      * @param resourceParameters additional information on the resource
//      * @return {@link AccessResult#ALLOWED} if access is permitted.  {@link AccessResult#DENIED} if access is denied.
//      * {@link AccessResult#NOT_SPECIFIED} if access is not specified.
//      */
//     AccessResult checkAccess(List<String> resourceNames,
//                              Map<String, String> resourceParameters);
// }
// 
// Path: app/models/deadbolt/AccessResult.java
// public enum AccessResult
// {
//     ALLOWED,
//     DENIED,
//     NOT_SPECIFIED
// }


import controllers.deadbolt.RestrictedResourcesHandler;
import models.deadbolt.AccessResult;
import java.util.List;
import java.util.Map;
/*
 * Copyright 2010-2011 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;



/**
 * @author Steve Chaloner (steve@objectify.be)
 */
public class MyRestrictedResourcesHandler implements RestrictedResourcesHandler
{
    /**
     * Various things can be done here, such as checking in a database table that maps the resource name to the
     * current user name or a group the user is in.  There are two rules and one guideline for an easy life here:
     * <ol>
     *     <li>If access is allowed, return {@link models.deadbolt.AccessResult#ALLOWED}</li>
     *     <li>If access is denied, return {@link models.deadbolt.AccessResult#DENIED}</li>
     *     <li>If access is not specified in, e.g. the database you can choose to return {@link models.deadbolt.AccessResult#ALLOWED}
     *     or {@link models.deadbolt.AccessResult#DENIED} if you have a hard policy for this situation; alternatively you can return
     *     {@link models.deadbolt.AccessResult#NOT_SPECIFIED} and allow further processing.</li>
     * </ol>
     *
     * {@inheritDoc}
     */
// Path: app/controllers/deadbolt/RestrictedResourcesHandler.java
// public interface RestrictedResourcesHandler
// {
//     /**
//      * Check the access of someone, typically the current user, for the named resource.
//      *
//      * <ul>
//      * <li>If {@link AccessResult#NOT_SPECIFIED} is returned and
//      * {@link controllers.deadbolt.RestrictedResource#staticFallback()} is false, access is denied.</li>
//      * <li>If {@link AccessResult#NOT_SPECIFIED} is returned and
//      * {@link controllers.deadbolt.RestrictedResource#staticFallback()} is true, any further Restrict or
//      * Restrictions annotations are processed.  Note that if no Restrict or Restrictions annotations are present,
//      * access will be allowed.</li>
//      * </ul>
//      *
//      * @param resourceNames the names of the resource
//      * @param resourceParameters additional information on the resource
//      * @return {@link AccessResult#ALLOWED} if access is permitted.  {@link AccessResult#DENIED} if access is denied.
//      * {@link AccessResult#NOT_SPECIFIED} if access is not specified.
//      */
//     AccessResult checkAccess(List<String> resourceNames,
//                              Map<String, String> resourceParameters);
// }
// 
// Path: app/models/deadbolt/AccessResult.java
// public enum AccessResult
// {
//     ALLOWED,
//     DENIED,
//     NOT_SPECIFIED
// }


// Path: samples-and-tests/unrestricted-samples/app/controllers/MyRestrictedResourcesHandler.java
import controllers.deadbolt.RestrictedResourcesHandler;
import models.deadbolt.AccessResult;
import java.util.List;
import java.util.Map;

/*
 * Copyright 2010-2011 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;



/**
 * @author Steve Chaloner (steve@objectify.be)
 */
public class MyRestrictedResourcesHandler implements RestrictedResourcesHandler
{
    /**
     * Various things can be done here, such as checking in a database table that maps the resource name to the
     * current user name or a group the user is in.  There are two rules and one guideline for an easy life here:
     * <ol>
     *     <li>If access is allowed, return {@link models.deadbolt.AccessResult#ALLOWED}</li>
     *     <li>If access is denied, return {@link models.deadbolt.AccessResult#DENIED}</li>
     *     <li>If access is not specified in, e.g. the database you can choose to return {@link models.deadbolt.AccessResult#ALLOWED}
     *     or {@link models.deadbolt.AccessResult#DENIED} if you have a hard policy for this situation; alternatively you can return
     *     {@link models.deadbolt.AccessResult#NOT_SPECIFIED} and allow further processing.</li>
     * </ol>
     *
     * {@inheritDoc}
     */
    public AccessResult checkAccess(List<String> resourceNames,