aclresourcewrapper.java
来自「java 写的一个新闻发布系统」· Java 代码 · 共 118 行
JAVA
118 行
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .//////// NK 24.01.2002 - added in Jahia//package org.jahia.services.acl;import org.jahia.services.usermanager.JahiaUser;/** * This is a wrapper to manipulate any resource that implements the ACLResourceInterface. * * @author Khue Nguyen * * @see ACLResourceInterface * @version 1.0 */public final class ACLResourceWrapper{ // the resource private ACLResourceInterface res; //-------------------------------------------------------------------------- public ACLResourceWrapper(ACLResourceInterface res){ this.res = res; } //-------------------------------------------------------------------------- /** * Returns the res' ACL * * @return Return the ACL. */ public JahiaBaseACL getACL (){ return res.getACL(); } //-------------------------------------------------------------------------- /** * Returns the res' ACL id * * @return Return the res' ACL id. */ public int getAclID (){ int id = -1; try { id = getACL().getID(); } catch (JahiaACLException ex) { // This exception should not happen ... :) } return id; } //-------------------------------------------------------------------------- /** * Check if the user has administration access on the specified resource. * * @param user Reference to the user. * @param siteID, the context used to retrieve the site's administrator group * * @return Return true if the user has admin access for the specified res, * or false in any other case. */ public final boolean checkAdminAccess (JahiaUser user, int siteID) { return ACLResource.checkAdminAccess (res, user, siteID); } //-------------------------------------------------------------------------- /** * Check if the user has read access on the specified res. * * @param user Reference to the user. * @param siteID, the context used to retrieve the site's administrator group * * @return Return true if the user has read access for the specified res, * or false in any other case. */ public final boolean checkReadAccess (JahiaUser user, int siteID) { return ACLResource.checkReadAccess (res, user, siteID); } //-------------------------------------------------------------------------- /** * Check if the user has Write access on the specified res. * * @param user Reference to the user. * * @return Return true if the user has read access for the specified res, * or false in any other case. */ public final boolean checkWriteAccess (JahiaUser user, int siteID) { return ACLResource.checkWriteAccess (res, user, siteID); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?