org.mycore.frontend.cli
Class MCRAccessCommands

java.lang.Object
  extended by org.mycore.frontend.cli.MCRAbstractCommands
      extended by org.mycore.frontend.cli.MCRAccessCommands
All Implemented Interfaces:
MCRExternalCommandInterface

public class MCRAccessCommands
extends MCRAbstractCommands

This class provides a set of commands for the org.mycore.access management which can be used by the command line interface.

Version:
$Revision: 1.11 $ $Date: 2008/11/27 07:58:28 $
Author:
Heiko Helmbrecht, Jens Kupferschmidt

Field Summary
 
Fields inherited from class org.mycore.frontend.cli.MCRAbstractCommands
command, CONFIG
 
Constructor Summary
MCRAccessCommands()
          The constructor.
 
Method Summary
static void createPermissionsFromFile(String filename)
          This method sets the new permissions given in a certain file
static void deleteAllPermissions()
          delete all permissions
static void deletePermission(String permission)
          delete the permission {0}
static void exportAllPermissionsToFile(String filename)
          This method just export the permissions to a file
static void listAllPermissions()
          This method invokes MCRUserMgr.getAllPrivileges() and retrieves a ArrayList of all privileges stored in the persistent datastore.
static void loadPermissionsFromFile(String filename)
          This method deletes the old permissions (if given any) and sets the new permissions given in a certain file
static void permissionDeleteAllForID(String id)
          delete all permissions for a given id
static void permissionDeleteAllForSelected()
          delete all permissions for all selected objects
static void permissionDeleteForID(String permission, String id)
          delete a given permission for a given id
static void permissionDeleteForSelected(String permission)
          delete all permissions for all selected objects
static void permissionUpdateForID(String permission, String id, String strFileRule)
          updates the permission for a given id and a given permission type with a given rule
static void permissionUpdateForID(String permission, String id, String strFileRule, String description)
          updates the permission for a given id and a given permission type with a given rule
static void permissionUpdateForSelected(String permission, String strFileRule)
          updates the permissions for all ids of a given MCRObjectID-Type with a given rule and a given permission
static void permissionUpdateForSelected(String permission, String strFileRule, String description)
          updates the permissions for all ids of a given MCRObjectID-Type and for a given permission type with a given rule
 
Methods inherited from class org.mycore.frontend.cli.MCRAbstractCommands
getPossibleCommands
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRAccessCommands

public MCRAccessCommands()
The constructor.

Method Detail

createPermissionsFromFile

public static void createPermissionsFromFile(String filename)
This method sets the new permissions given in a certain file

Parameters:
filename - the filename of the file that contains the mcrpermissions

loadPermissionsFromFile

public static void loadPermissionsFromFile(String filename)
                                    throws Exception
This method deletes the old permissions (if given any) and sets the new permissions given in a certain file

Parameters:
filename - the filename of the file that contains the mcrpermissions
Throws:
Exception
See Also:
#updatePermissionsFromFile(String)

deleteAllPermissions

public static void deleteAllPermissions()
                                 throws Exception
delete all permissions

Throws:
Exception

deletePermission

public static void deletePermission(String permission)
                             throws Exception
delete the permission {0}

Parameters:
permission - the name of the permission
Throws:
Exception

listAllPermissions

public static void listAllPermissions()
                               throws MCRException
This method invokes MCRUserMgr.getAllPrivileges() and retrieves a ArrayList of all privileges stored in the persistent datastore.

Throws:
MCRException

exportAllPermissionsToFile

public static final void exportAllPermissionsToFile(String filename)
                                             throws Exception
This method just export the permissions to a file

Parameters:
filename - the file written to
Throws:
Exception

permissionUpdateForID

public static void permissionUpdateForID(String permission,
                                         String id,
                                         String strFileRule)
updates the permission for a given id and a given permission type with a given rule

Parameters:
permission - String type of permission like read, writedb, etc.
id - String the id of the object the rule is assigned to
strFileRule - String the path to the xml file, that contains the rule

permissionUpdateForID

public static void permissionUpdateForID(String permission,
                                         String id,
                                         String strFileRule,
                                         String description)
updates the permission for a given id and a given permission type with a given rule

Parameters:
permission - String type of permission like read, writedb, etc.
id - String the id of the object the rule is assigned to
strFileRule - String the path to the xml file, that contains the rule
description - String give a special description, if the semantics of your rule is multiple used

permissionUpdateForSelected

public static void permissionUpdateForSelected(String permission,
                                               String strFileRule)
updates the permissions for all ids of a given MCRObjectID-Type with a given rule and a given permission

Parameters:
permission - String type of permission like read, writedb, etc.
documentType - String a MCRObjectID-Type like document, disshab, etc.
strFileRule - String the path to the xml file, that contains the rule

permissionUpdateForSelected

public static void permissionUpdateForSelected(String permission,
                                               String strFileRule,
                                               String description)
updates the permissions for all ids of a given MCRObjectID-Type and for a given permission type with a given rule

Parameters:
permission - String type of permission like read, writedb, etc.
documentType - String a MCRObjectID-Type like document, disshab, etc.
strFileRule - String the path to the xml file, that contains the rule
description - String give a special description, if the semantics of your rule is multiple used

permissionDeleteForID

public static void permissionDeleteForID(String permission,
                                         String id)
delete a given permission for a given id

Parameters:
permission - String type of permission like read, writedb, etc.
id - String the id of the object the rule is assigned to

permissionDeleteAllForID

public static void permissionDeleteAllForID(String id)
delete all permissions for a given id

Parameters:
id - String the id of the object the rule is assigned to

permissionDeleteForSelected

public static void permissionDeleteForSelected(String permission)
delete all permissions for all selected objects

Parameters:
permission - String type of permission like read, writedb, etc.
See Also:
MCRObjectCommands.getSelectedObjectIDs()

permissionDeleteAllForSelected

public static void permissionDeleteAllForSelected()
delete all permissions for all selected objects

See Also:
MCRObjectCommands.getSelectedObjectIDs()