001: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal.security;
007:
008: import java.util.Vector;
009:
010: import org.jasig.portal.AuthorizationException;
011:
012: /**
013: * An <code>IAuthorizationPrincipal</code> represents a portal entity to which
014: * <code>IPermissions</code> have been granted. Such an entity could be an <code>IGroupMember</code>,
015: * an <code>IChannel</code> or an <code>IPerson</code>.
016: *
017: * @author Dan Ellentuck
018: * @version $Revision: 34783 $
019: */
020: public interface IAuthorizationPrincipal {
021: /**
022: * Answers if this <code>IAuthorizationPrincipal</code> has permission to publish.
023: * @return boolean
024: * @exception AuthorizationException thrown when authorization information could not be retrieved.
025: */
026: boolean canPublish() throws AuthorizationException;
027:
028: /**
029: * Answers if this <code>IAuthoriztionPrincipal</code> has permission to render this channel.
030: * @return boolean
031: * @param channelPublishId int - the Channel publish Id
032: * @exception AuthorizationException thrown when authorization information could not be retrieved.
033: */
034: boolean canRender(int channelPublishId)
035: throws AuthorizationException;
036:
037: /**
038: * Answers if this <code>IAuthorizationPrincipal</code> has permission to subscribe to this channel.
039: * @return boolean
040: * @param channelPublishId int - the Channel Id
041: * @exception AuthorizationException thrown when authorization information could not be retrieved.
042: */
043: boolean canSubscribe(int channelPublishId)
044: throws AuthorizationException;
045:
046: /**
047: * Returns the <code>IPermissions</code> for this <code>IAuthorizationPrincipal</code>,
048: * including inherited <code>Permissions</code>.
049: *
050: * @return org.jasig.portal.security.IPermission[]
051: * @exception AuthorizationException indicates authorization information could not
052: * be retrieved.
053: */
054: public IPermission[] getAllPermissions()
055: throws AuthorizationException;
056:
057: /**
058: * Returns the <code>IPermissions</code> for this <code>IAuthorizationPrincipal</code> for the
059: * specified <code>owner</code>, <code>activity</code> and <code>target</code>. This includes
060: * inherited <code>IPermissions</code>. Null parameters are ignored, so
061: * <code>getPermissions(null, null, null)</code> should retrieve all <code>IPermissions</code>
062: * for an <code>IAuthorizationPrincipal</code>.
063: *
064: * @return org.jasig.portal.security.IPermission[]
065: * @param owner java.lang.String
066: * @param activity java.lang.String
067: * @param target java.lang.String
068: * @exception AuthorizationException indicates authorization information could not
069: * be retrieved.
070: */
071: public IPermission[] getAllPermissions(String owner,
072: String activity, String target)
073: throws AuthorizationException;
074:
075: /**
076: * Return a Vector of IChannels.
077: * @return a <code>java.util.Vector</code> of IChannels
078: * @exception AuthorizationException indicates authorization information could not be retrieved.
079: */
080: public Vector getAuthorizedChannels() throws AuthorizationException;
081:
082: /**
083: * Returns the key of the underlying entity.
084: * @return java.lang.String
085: */
086: public String getKey();
087:
088: /**
089: * Returns the <code>IPermissions</code> for this <code>IAuthorizationPrincipal</code>.
090: *
091: * @return org.jasig.portal.security.IPermission[]
092: * @exception AuthorizationException indicates authorization information could not
093: * be retrieved.
094: */
095: public IPermission[] getPermissions() throws AuthorizationException;
096:
097: /**
098: * Returns the <code>IPermissions</code> for this <code>IAuthorizationPrincipal</code> for the
099: * specified <code>owner</code>, <code>activity</code> and <code>target</code>. Null parameters
100: * are ignored, so <code>getPermissions(null, null, null)</code> should retrieve all
101: * <code>IPermissions</code> for an <code>IAuthorizationPrincipal</code>.
102: *
103: * @return org.jasig.portal.security.IPermission[]
104: * @param owner java.lang.String
105: * @param activity java.lang.String
106: * @param target java.lang.String
107: * @exception AuthorizationException indicates authorization information could not
108: * be retrieved.
109: */
110: public IPermission[] getPermissions(String owner, String activity,
111: String target) throws AuthorizationException;
112:
113: /**
114: * @return java.lang.String
115: */
116: public String getPrincipalString();
117:
118: /**
119: * Return the Type of the underlying entity.
120: * @return java.lang.Class
121: */
122: public Class getType();
123:
124: /**
125: * Answers if this <code>IAuthorizationPrincipal</code> has permission to perform the
126: * <code>activity</code> on the <code>target</code>. Params <code>owner</code> and
127: * <code>activity</code> must be non-null. If <code>target</code> is null, then the
128: * target is not checked.
129: *
130: * @return boolean
131: * @param owner java.lang.String
132: * @param activity java.lang.String
133: * @param target java.lang.String
134: * @exception AuthorizationException indicates authorization information could not
135: * be retrieved.
136: */
137: public boolean hasPermission(String owner, String activity,
138: String target) throws AuthorizationException;
139:
140: /**
141: * Answers if this <code>IAuthorizationPrincipal</code> has permission to perform the
142: * <code>activity</code> on the <code>target</code>, as evaluated by the
143: * <code>policy</code>. Params <code>policy</code>, <code>owner</code> and
144: * <code>activity</code> must be non-null.
145: *
146: * @return boolean
147: * @param owner java.lang.String
148: * @param activity java.lang.String
149: * @param target java.lang.String
150: * @param policy org.jasig.portal.security.IPermissionPolicy
151: * @exception AuthorizationException indicates authorization information could not
152: * be retrieved.
153: */
154: public boolean hasPermission(String owner, String activity,
155: String target, IPermissionPolicy policy)
156: throws AuthorizationException;
157: }
|