gabriel.components
Interface MethodAccessManager

All Known Subinterfaces:
ContextMethodAccessManager
All Known Implementing Classes:
ContextMethodAccessManagerImpl, MethodAccessManagerImpl

public interface MethodAccessManager

MethodAccessManager checks if a client is allowed to execute a method by mapping method names to permissions.

Version:
$Id: MethodAccessManager.java,v 1.1 2004/06/24 10:22:44 stephan Exp $
Author:
Stephan J. Schmidt

Method Summary
 void addMethod(Permission permission, java.lang.Class klass, java.lang.String method)
          Add a method for a permission.
 void addMethod(Permission permission, java.lang.String methodName)
          Add a method for a permission.
 void addMethods(Permission permission, java.util.List methodNames)
          Add a list of method names for a permission.
 void addMethods(Permission permission, java.lang.String[] methodNames)
          Add an array of method names for a permission.
 boolean checkPermission(java.util.Set principals, java.lang.Class klass, java.lang.String method)
          Check if a principal can execute a method.
 boolean checkPermission(java.util.Set principals, java.lang.String methodName)
          Check if a principal can execute a method.
 java.util.Set getPermissions(java.lang.String methodName)
          Get all permissions from which one is needed to execute the method.
 

Method Detail

addMethods

public void addMethods(Permission permission,
                       java.util.List methodNames)
Add a list of method names for a permission. Method names should follow "class.methodName".

Parameters:
permission - Permission which is needed to execute method
methodNames - Names of methods with access restrictions

addMethod

public void addMethod(Permission permission,
                      java.lang.Class klass,
                      java.lang.String method)
Add a method for a permission. The method is specified by a class and the method name.

Example: addMethod(new Permission("POST"), Blog.class, "post");

Parameters:
permission - Permission which is needed to execute method
klass - Class with the method
method - Name of the method to restirct access to

addMethod

public void addMethod(Permission permission,
                      java.lang.String methodName)
Add a method for a permission. Method names should follow "class.methodName"

Parameters:
permission - Permission which is needed to execute method
methodName - Name of method with access restrictions

addMethods

public void addMethods(Permission permission,
                       java.lang.String[] methodNames)
Add an array of method names for a permission. Convinience method.

Parameters:
permission - Permission which is needed to execute method
methodNames - Names of methods with access restrictions

getPermissions

public java.util.Set getPermissions(java.lang.String methodName)
Get all permissions from which one is needed to execute the method.

Parameters:
methodName - Method name to get the permission from
Returns:
Set of permissions which restrict method execution

checkPermission

public boolean checkPermission(java.util.Set principals,
                               java.lang.String methodName)
Check if a principal can execute a method. The principal needs one permission for the method to be allowed to execute it.

Parameters:
principals - Set of principals to check access to the method
methodName - Name of the method to check
Returns:
true if principal is allowed to execute the method

checkPermission

public boolean checkPermission(java.util.Set principals,
                               java.lang.Class klass,
                               java.lang.String method)
Check if a principal can execute a method. The principal needs one permission for the method to be allowed to execute it.

Parameters:
principals - Set of principals to check access to the method
klass - Class with the method
method - Name of the method to check
Returns:
true if principal is allowed to execute the method


Copyright © 2003 Matthias L. Jugel, Stephan J. Schmidt. All Rights Reserved .