1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.shiro.authz.permission; 20 21 import java.io.Serializable; 22 23 import org.apache.shiro.authz.Permission; 24 25 26 /** 27 * An all <tt>AllPermission</tt> instance is one that always implies any other permission; that is, its 28 * {@link #implies implies} method always returns <tt>true</tt>. 29 * 30 * <p>You should be very careful about the users, roles, and/or groups to which this permission is assigned since 31 * those respective entities will have the ability to do anything. As such, an instance of this class 32 * is typically only assigned only to "root" or "administrator" users or roles. 33 * 34 * @since 0.1 35 */ 36 public class AllPermission implements Permission, Serializable { 37 38 /** 39 * Always returns <tt>true</tt>, indicating any Subject granted this permission can do anything. 40 * 41 * @param p the Permission to check for implies logic. 42 * @return <tt>true</tt> always, indicating any Subject grated this permission can do anything. 43 */ 44 public boolean implies(Permission p) { 45 return true; 46 } 47 }