亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? basesecurityentry.java

?? jetspeed源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
 * Copyright 2000-2004 The Apache Software Foundation.
 * 
 * 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 org.apache.jetspeed.om.registry.base;

// Java imports
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import org.apache.jetspeed.om.registry.SecurityAccess;
import org.apache.jetspeed.om.registry.SecurityAllow;
import org.apache.jetspeed.om.registry.SecurityEntry;
import org.apache.jetspeed.services.security.GroupManagement;
import org.apache.jetspeed.services.security.RoleManagement;

/**
 * Interface for manipulatin the Security Entry on the registry entries
 *
 * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
 * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a> 
 * @version $Id: BaseSecurityEntry.java,v 1.15 2004/03/23 21:15:24 jford Exp $
 */
public class BaseSecurityEntry extends BaseRegistryEntry implements SecurityEntry, java.io.Serializable
{

    /** Holds value of property accesses. */
    private Vector accesses = new Vector();

    private transient Map accessMap = null;

    public static final String ALL_ACTIONS = "*";

    public static final String ALL_ROLES = "*";

	public static final String ALL_GROUPS = "*";    

	public static final String ALL_GROUP_ROLES = "*";	

    public static final String ALL_USERS = "*";

    private static final String OWNER_MAP = "owner";

    private static final String ROLE_MAP = "role";

	private static final String GROUP_MAP = "group";    
	
	private static final String GROUP_ROLE_MAP = "grouprole";	

    private static final String USER_MAP = "user";

    private static transient Object accessMapSync = new Object();

    public BaseSecurityEntry()
    { }

    /**
     * Implements the equals operation so that 2 elements are equal if
     * all their member values are equal.
     */
    public boolean equals(Object object)
    {
        if (object == null)
        {
            return false;
        }

        BaseSecurityEntry obj = (BaseSecurityEntry) object;

        Iterator i = accesses.iterator();
        Iterator i2 = obj.accesses.iterator();
        while (i.hasNext())
        {
            BaseSecurityAccess c1 = (BaseSecurityAccess) i.next();
            BaseSecurityAccess c2 = null;

            if (i2.hasNext())
            {
                c2 = (BaseSecurityAccess) i2.next();
            }
            else
            {
                return false;
            }

            if (!c1.equals(c2))
            {
                return false;
            }
        }

        if (i2.hasNext())
        {
            return false;
        }

        return super.equals(object);
    }

    /** Getter for property accesses.
     * @return Value of property accesses.
     */
    public Vector getAccesses()
    {
        return accesses;
    }

    /** Setter for property accesses.
     * @param accesses New value of property accesses.
     */
    public void setAccesses(Vector accesses)
    {
        this.accesses = accesses;
        buildAccessMap();
    }

    /**
     * Aututhorizes action for a role.
     *
     * o If the requested action and the action ALL_ACTIONS
     *   do not exist, then return false.
     *
     * o If the requesting role and ALL_ROLES does not exist for the
     *   the action, then return false.
     *
     * @param role requesting action
     * @param action being requested
     * @return <CODE>true</CODE> if action is allowed for role
     */
    public boolean allowsRole(String role, String action)
    {
        Map allowMap = null;
        boolean allow = false;

        if (accessMap == null)
        {
            buildAccessMap();
        }

        // Checked action
        allowMap = (Map) accessMap.get(action);
        allow = isInAllowMap(allowMap, ROLE_MAP, role, ALL_ROLES);
        if (allow == true)
        {
            return allow;
        }

        // Checked all actions
        allowMap = (Map) accessMap.get(ALL_ACTIONS);
        allow = isInAllowMap(allowMap, ROLE_MAP, role, ALL_ROLES);

        // Not allowed
        return allow;
    }

	/**
	 * Aututhorizes action for a group.
	 *
	 * o If the requested action and the action ALL_ACTIONS
	 *   do not exist, then return false.
	 *
	 * o If the requesting role and ALL_GROUP does not exist for the
	 *   the action, then return false.
	 *
	 * @param group requesting action
	 * @param action being requested
	 * @return <CODE>true</CODE> if action is allowed for group
	 */
	public boolean allowsGroup(String group, String action)
	{
		Map allowMap = null;
		boolean allow = false;

		if (accessMap == null)
		{
			buildAccessMap();
		}

		// Checked action
		allowMap = (Map) accessMap.get(action);
		allow = isInAllowMap(allowMap, GROUP_MAP, group, ALL_GROUPS);
		if (allow == true)
		{
			return allow;
		}

		// Checked all actions
		allowMap = (Map) accessMap.get(ALL_ACTIONS);
		allow = isInAllowMap(allowMap, GROUP_MAP, group, ALL_GROUPS);

		// Not allowed
		return allow;
	}

	/**
	 * Authorizes action for a group role.
	 *
	 * o If the requested action and the action ALL_ACTIONS
	 *   do not exist, then return false.
	 *
	 * o If the requesting group role and ALL_GROUPS_ROLES does not exist for the
	 *   the action, then return false.
	 *
	 * @param group requesting action
	 * @param role requesting action 
	 * @param action being requested
	 * @return <CODE>true</CODE> if action is allowed for group role
	 */
	public boolean allowsGroupRole(String group, String role, String action)
	{
		Map allowMap = null;
		boolean allow = false;

		if (accessMap == null)
		{
			buildAccessMap();
		}

		// Checked action
		allowMap = (Map) accessMap.get(action);
		allow = isInAllowMap(allowMap, GROUP_ROLE_MAP, group+role, ALL_GROUP_ROLES);
		if (allow == true)
		{
			return allow;
		}

		// Checked all actions
		allowMap = (Map) accessMap.get(ALL_ACTIONS);
		allow = isInAllowMap(allowMap, GROUP_ROLE_MAP, group+role, ALL_GROUP_ROLES);

		// Not allowed
		return allow;
	}

    /**
     * Aututhorizes action for a named user
     *
     * @param userName requesting action
     * @param action being requested
     * @return <CODE>true</CODE> if action is allowed for named user
     */
    public boolean allowsUser(String userName, String action)
    {
        return allowsUser(userName, action, null);
    }
    /**
     * Aututhorizes action for a named user
     *
     * @param userName requesting action
     * @param action being requested
     * @param owner User
     * @return <CODE>true</CODE> if action is allowed for named user
     */
    public boolean allowsUser(String userName, String action, String owner)
    {
        Map allowMap = null;
        boolean allow = false;

        if (accessMap == null)
        {
            buildAccessMap();
        }
        if ((owner != null) && (owner.equals(userName)))
        {
            // Checked action
            allowMap = (Map) accessMap.get(action);
            allow = isInAllowMap(allowMap, OWNER_MAP, null, null);
            if (allow == true)
            {
                return allow;
            }

            // Checked action
            allowMap = (Map) accessMap.get(ALL_ACTIONS);
            allow = isInAllowMap(allowMap, OWNER_MAP, null, null);
            if (allow == true)
            {
                return allow;
            }
        }

        // Checked action
        allowMap = (Map) accessMap.get(action);
        allow = isInAllowMap(allowMap, USER_MAP, userName, ALL_USERS);
        if (allow == true)
        {
            return allow;
        }

        // Checked all actions
        allowMap = (Map) accessMap.get(ALL_ACTIONS);
        allow = isInAllowMap(allowMap, USER_MAP, userName, ALL_USERS);

        // Not allowed
        return allow;

    }
    
    /**
     * Checks whether a role is specifically allowed to access the request action
     * This method ignores the "*" action and is here to play a maintenance role.
     */
    public boolean allowsSpecificRole( String action, String role)
    {
        SecurityAccess access = (SecurityAccess) getAccess(action);
        if (access.getAllAllows() != null)
        {
            Iterator allAllows = access.getAllows().iterator();
            while (allAllows.hasNext())
            {
                SecurityAllow allow = (SecurityAllow) allAllows.next();
                if (allow.getRole() != null && allow.getRole().equals(role))
                {
                    return true;
                }
            }
        }
        return false;
    }

	/**
	 * Checks whether a group is specifically allowed to access the request action
	 * This method ignores the "*" action and is here to play a maintenance role.
	 */
	public boolean allowsSpecificGroup(String action, String group)
	{
		SecurityAccess access = (SecurityAccess) getAccess(action);
		if (access.getAllAllows() != null)
		{
			Iterator allAllows = access.getAllows().iterator();
			while (allAllows.hasNext())
			{
				SecurityAllow allow = (SecurityAllow) allAllows.next();
				if (allow.getGroup() != null && allow.getGroup().equals(group))
				{
					return true;
				}
			}
		}
		return false;
	}

	/**
	 * Checks whether a group role is specifically allowed to access the request action
	 * This method ignores the "*" action and is here to play a maintenance role.
	 */
	public boolean allowsSpecificGroupRole(String action, String group, String role)
	{
		SecurityAccess access = (SecurityAccess) getAccess(action);
		if (access.getAllAllows() != null)
		{
			Iterator allAllows = access.getAllows().iterator();
			while (allAllows.hasNext())
			{
				SecurityAllow allow = (SecurityAllow) allAllows.next();
				if (allow.getGroup() != null && 
					allow.getGroup().equals(group) &&
					allow.getRole() != null &&
					allow.getRole().equals(role))
				{
					return true;
				}
			}
		}
		return false;
	}
    
        /**
        * Checks whether a role is specifically allowed to access the request action
        * This method ignores the "*" action and is here to play a maintenance role.
        * @param String action name of action to check
        * @param String role name of role to verify access for
        * @return boolean whether or not the <code>role</code> has access
        * to this specific action.
        */
    public boolean allowsSpecificUser(String action, String user)
    {
        BaseSecurityAccess access = (BaseSecurityAccess) getAccess(action);
        if (access.getAllAllows() != null)
        {
            Iterator allAllows = access.getAllows().iterator();
            while (allAllows.hasNext())
            {
                BaseSecurityAllow allow = (BaseSecurityAllow) allAllows.next();
                if (allow.getUser() != null && allow.getUser().equals(user))
                {
                    return true;
                }
            }
        }
        return false;
    }

    
    
    
    /**
     * Returns the SecurityAccess object for the <code>action</code>
     * requested or null if no specific access is defined for this action.
     * The "*" does change this, if an action is not specifically defined
     * in the registry, null is returned
     * @param SecurityEntry entry SecurityEntry to check against
     * @param String action The action we want the access for.
     * @return SecurityAccess that is defined for this action or
     * <code>null</code> if one is not <strong>specifically defined</strong>
     */
    public SecurityAccess getAccess(String action)
    {
        Iterator itr = getAccesses().iterator();
        while (itr.hasNext())
        {
            BaseSecurityAccess access = (BaseSecurityAccess) itr.next();
            if (access.getAction().equals(action))
            {
                return access;
            }
        }

        return null;
    }
    
    /**
     * Grants access for a specific action to a specific role
     * for this SecurityEntry.  This grants specific access ignores
     * "*" action, if it exists.
     * @param String action The action we are granting access to.
     * @param String role The role that will receive access to this action.
     * @return boolean Whether or not the access was granted. Basically,
     *  a <code>false</code> means that this role already has specific access.
     */
    public boolean grantRoleAccess(String action, String role)
    {
        if (!allowsSpecificRole(action, role))
        {
            SecurityAccess access = getAccess(action);
            List allows = access.getAllows();
            if (allows == null)
            {
                allows = new Vector();
            }

            BaseSecurityAllow allow = new BaseSecurityAllow();
            allow.setRole(role);
            allows.add(allow);
            
            buildAccessMap();
            
            return true;
        }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一卡二卡三卡日韩欧美| 亚洲精品免费在线观看| 性做久久久久久久免费看| 国产.欧美.日韩| 日韩写真欧美这视频| 亚洲一区二区三区免费视频| 成人av免费在线播放| 精品sm捆绑视频| 天堂影院一区二区| 欧美亚洲禁片免费| 亚洲欧洲成人自拍| 国产白丝精品91爽爽久久| 欧美va亚洲va香蕉在线| 爽好多水快深点欧美视频| 色8久久人人97超碰香蕉987| 中文字幕一区二区在线播放| 国产v日产∨综合v精品视频| 精品久久久久香蕉网| 日韩电影在线观看一区| 欧美日韩久久不卡| 亚洲成人资源网| 欧美午夜片在线看| 亚洲另类春色校园小说| 99在线热播精品免费| 国产欧美视频在线观看| 国产一区二区在线观看视频| 欧美成人官网二区| 精品一二三四在线| 日韩免费观看高清完整版在线观看| 亚洲超碰精品一区二区| 91九色最新地址| 亚洲精品乱码久久久久久久久| 波多野洁衣一区| 国产精品乱码一区二区三区软件 | 亚洲国产日韩a在线播放| 91色乱码一区二区三区| 亚洲另类一区二区| 在线看日韩精品电影| 一区二区欧美国产| 欧美性色黄大片| 手机精品视频在线观看| 91精品午夜视频| 久久精品72免费观看| 精品国产乱码久久久久久1区2区| 久久se精品一区二区| 久久久久久久久久久久久久久99| 国产精品资源在线观看| 日本一区二区三区电影| 99九九99九九九视频精品| 中文字幕亚洲一区二区av在线| 欧美一级艳片视频免费观看| 日本vs亚洲vs韩国一区三区二区| 日韩欧美成人激情| 国产精品456露脸| 亚洲欧洲成人av每日更新| 91国模大尺度私拍在线视频| 亚洲在线免费播放| 88在线观看91蜜桃国自产| 久久99久久99| 国产精品久久久久久久岛一牛影视| 91美女片黄在线观看| 亚洲国产精品综合小说图片区| 在线成人高清不卡| 国内久久婷婷综合| 亚洲欧洲日韩一区二区三区| 色爱区综合激月婷婷| 免费在线欧美视频| 国产丝袜在线精品| 色综合久久久久| 日产国产高清一区二区三区 | 成人ar影院免费观看视频| 亚洲精品国产一区二区精华液| 欧美二区三区的天堂| 国产精品18久久久久| 亚洲婷婷综合色高清在线| 欧美日韩国产成人在线91| 国产一区二区导航在线播放| 亚洲色图欧洲色图| 日韩西西人体444www| 成人午夜精品一区二区三区| 亚洲福利视频一区| 国产亚洲一区二区三区在线观看 | 北条麻妃一区二区三区| 偷拍一区二区三区| 亚洲国产经典视频| 欧美精品丝袜中出| 顶级嫩模精品视频在线看| 亚洲h动漫在线| 日本一区二区三区高清不卡| 欧美日韩国产小视频在线观看| 国产精品中文字幕欧美| 亚洲一区二区三区四区五区黄 | 91精品国产色综合久久久蜜香臀| 国产精品88888| 天使萌一区二区三区免费观看| 国产视频一区二区在线| 欧美日韩国产一级片| 风间由美一区二区三区在线观看 | 国产精品午夜电影| 91精品国产欧美一区二区18| 99麻豆久久久国产精品免费 | 亚洲永久精品大片| 国产日韩av一区| 欧美一卡2卡3卡4卡| 色噜噜狠狠色综合欧洲selulu| 看电视剧不卡顿的网站| 亚洲一区二区在线观看视频| 久久精品免视看| 亚洲视频你懂的| 精品国产乱码久久久久久牛牛 | 狠狠色综合播放一区二区| 亚洲乱码国产乱码精品精可以看 | 日韩久久精品一区| 在线观看网站黄不卡| 高清不卡一二三区| 久久99精品网久久| 婷婷综合在线观看| 亚洲精品成人a在线观看| 国产嫩草影院久久久久| 精品剧情在线观看| 欧美夫妻性生活| 欧美午夜精品久久久久久孕妇| 成人午夜在线免费| 国产精品99久久久久| 久久成人久久爱| 视频在线观看91| 亚洲国产另类精品专区| 亚洲免费在线视频一区 二区| 国产日韩欧美一区二区三区乱码 | 欧洲av在线精品| 91女人视频在线观看| 成人激情小说乱人伦| 国产精品一级片| 极品尤物av久久免费看| 免费在线成人网| 奇米777欧美一区二区| 亚洲网友自拍偷拍| 亚洲综合偷拍欧美一区色| 亚洲欧美偷拍另类a∨色屁股| 国产精品美女久久久久久久久| 国产拍揄自揄精品视频麻豆| 精品国产一区二区三区四区四 | 欧美老年两性高潮| 色8久久精品久久久久久蜜| 91蝌蚪国产九色| 91亚洲永久精品| 91蜜桃免费观看视频| 99国产精品久久久久久久久久久 | 国产精品91xxx| 国产乱理伦片在线观看夜一区| 狠狠色丁香九九婷婷综合五月| 青青青伊人色综合久久| 美女精品自拍一二三四| 日本三级亚洲精品| 久久精品国产99国产| 久久99国产精品免费| 国产一区欧美二区| 国产高清成人在线| 成人激情黄色小说| 91色乱码一区二区三区| 欧美影片第一页| 欧美日本在线一区| 日韩精品最新网址| 久久人人超碰精品| 国产精品乱码人人做人人爱| 亚洲欧美国产77777| 亚洲国产一二三| 免费久久精品视频| 国产乱人伦精品一区二区在线观看| 国产成人精品免费一区二区| www.成人网.com| 欧美四级电影网| 亚洲三级久久久| 亚洲www啪成人一区二区麻豆| 视频一区二区欧美| 精久久久久久久久久久| 成人深夜福利app| 在线免费观看日本欧美| 欧美一区二区三区在线电影| 欧美精品一区二区在线观看| 国产午夜亚洲精品羞羞网站| 亚洲欧美日韩国产综合在线| 亚洲成人av中文| 激情深爱一区二区| 成人app在线| 欧美高清性hdvideosex| wwwwww.欧美系列| 亚洲摸摸操操av| 美女任你摸久久| 成人av在线资源| 69成人精品免费视频| 久久久久久久久97黄色工厂| 亚洲欧美成人一区二区三区| 免费成人深夜小野草| www.99精品| 欧美一区二区黄色| 国产精品黄色在线观看| 午夜av一区二区| 成人美女在线观看| 欧美丰满嫩嫩电影|