/**
* Copyright (c) 2001 The JA-SIG Collaborative. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the JA-SIG Collaborative
* (http://www.jasig.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE JA-SIG COLLABORATIVE "AS IS" AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JA-SIG COLLABORATIVE OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package org.jasig.portal.security;
import java.util.Vector;
import org.jasig.portal.AuthorizationException;
/**
* An IAuthorizationPrincipal
represents a portal entity to which
* IPermissions
have been granted. Such an entity could be an IGroupMember
,
* an IChannel
or an IPerson
.
*
* @author Dan Ellentuck
* @author rtwigg@uccs.edu
* @version $Revision: 1.7 $
*/
public interface IAuthorizationPrincipal {
/**
* Answers if this IAuthorizationPrincipal
has permission to publish.
* @return boolean
* @exception AuthorizationException thrown when authorization information could not be retrieved.
*/
boolean canPublish() throws AuthorizationException;
/**
* Answers if this IAuthoriztionPrincipal
has permission to render this channel.
* @return boolean
* @param channelPublishId int - the Channel publish Id
* @exception AuthorizationException thrown when authorization information could not be retrieved.
*/
boolean canRender(int channelPublishId) throws AuthorizationException;
/**
* Answers if this IAuthorizationPrincipal
has permission to subscribe to this channel.
* @return boolean
* @param channelPublishId int - the Channel Id
* @exception AuthorizationException thrown when authorization information could not be retrieved.
*/
boolean canSubscribe(int channelPublishId) throws AuthorizationException;
/**
* Answers if this IAuthorizationPrincipal
has permission to subscribe to this channel.
* @return boolean
* @param channelPublishId int - the Channel Id
* @exception AuthorizationException thrown when authorization information could not be retrieved.
*/
boolean canPublish(int channelPublishId) throws AuthorizationException;
/**
* Answers if this IAuthorizationPrincipal
has permission to edit this channel.
* @return boolean
* @param channelPublishId int - the Channel Id
* @exception AuthorizationException thrown when authorization information could not be retrieved.
*/
boolean canEdit(int channelPublishId) throws AuthorizationException;
/**
* Returns the IPermissions
for this IAuthorizationPrincipal
,
* including inherited Permissions
.
*
* @return org.jasig.portal.security.IPermission[]
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public IPermission[] getAllPermissions() throws AuthorizationException;
/**
* Returns the IPermissions
for this IAuthorizationPrincipal
for the
* specified owner
, activity
and target
. This includes
* inherited IPermissions
. Null parameters are ignored, so
* getPermissions(null, null, null)
should retrieve all IPermissions
* for an IAuthorizationPrincipal
.
*
* @return org.jasig.portal.security.IPermission[]
* @param owner java.lang.String
* @param activity java.lang.String
* @param target java.lang.String
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public IPermission[] getAllPermissions(String owner, String activity, String target)
throws AuthorizationException;
/**
* Return a Vector of IChannels.
* @return a java.util.Vector
of IChannels
* @exception AuthorizationException indicates authorization information could not be retrieved.
*/
public Vector getAuthorizedChannels() throws AuthorizationException;
/**
* Returns the key of the underlying entity.
* @return java.lang.String
*/
public String getKey();
/**
* Returns the IPermissions
for this IAuthorizationPrincipal
.
*
* @return org.jasig.portal.security.IPermission[]
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public IPermission[] getPermissions() throws AuthorizationException;
/**
* Returns the IPermissions
for this IAuthorizationPrincipal
for the
* specified owner
, activity
and target
. Null parameters
* are ignored, so getPermissions(null, null, null)
should retrieve all
* IPermissions
for an IAuthorizationPrincipal
.
*
* @return org.jasig.portal.security.IPermission[]
* @param owner java.lang.String
* @param activity java.lang.String
* @param target java.lang.String
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public IPermission[] getPermissions(String owner, String activity, String target)
throws AuthorizationException;
/**
* @return java.lang.String
*/
public String getPrincipalString();
/**
* Return the Type of the underlying entity.
* @return java.lang.Class
*/
public Class getType();
/**
* Answers if this IAuthorizationPrincipal
has permission to perform the
* activity
on the target
. Params owner
and
* activity
must be non-null. If target
is null, then the
* target is not checked.
*
* @return boolean
* @param owner java.lang.String
* @param activity java.lang.String
* @param target java.lang.String
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public boolean hasPermission(String owner, String activity, String target) throws
AuthorizationException;
/**
* Answers if this IAuthorizationPrincipal
has permission to perform the
* activity
on the target
, as evaluated by the
* policy
. Params policy
, owner
and
* activity
must be non-null.
*
* @return boolean
* @param owner java.lang.String
* @param activity java.lang.String
* @param target java.lang.String
* @param policy org.jasig.portal.security.IPermissionPolicy
* @exception AuthorizationException indicates authorization information could not
* be retrieved.
*/
public boolean hasPermission(String owner, String activity, String target, IPermissionPolicy policy)
throws AuthorizationException;
}