001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.shiro.authz.permission;
020
021import java.io.Serializable;
022
023import org.apache.shiro.authz.Permission;
024
025
026/**
027 * An all <tt>AllPermission</tt> instance is one that always implies any other permission; that is, its
028 * {@link #implies implies} method always returns <tt>true</tt>.
029 *
030 * <p>You should be very careful about the users, roles, and/or groups to which this permission is assigned since
031 * those respective entities will have the ability to do anything.  As such, an instance of this class
032 * is typically only assigned only to "root" or "administrator" users or roles.
033 *
034 * @since 0.1
035 */
036public class AllPermission implements Permission, Serializable {
037
038    /**
039     * Always returns <tt>true</tt>, indicating any Subject granted this permission can do anything.
040     *
041     * @param p the Permission to check for implies logic.
042     * @return <tt>true</tt> always, indicating any Subject grated this permission can do anything.
043     */
044    public boolean implies(Permission p) {
045        return true;
046    }
047}