Skip to content

Commit

Permalink
Removed unneccessary methods and added control permission
Browse files Browse the repository at this point in the history
  • Loading branch information
cWeinholz committed Jun 13, 2003
1 parent 54d833c commit 93e36af
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 666 deletions.
48 changes: 3 additions & 45 deletions src/com/opencms/core/CmsShellCommands.java
@@ -1,7 +1,7 @@
/*
* File : $Source: /alkacon/cvs/opencms/src/com/opencms/core/Attic/CmsShellCommands.java,v $
* Date : $Date: 2003/06/13 10:04:20 $
* Version: $Revision: 1.76 $
* Date : $Date: 2003/06/13 16:15:55 $
* Version: $Revision: 1.77 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
Expand Down Expand Up @@ -64,7 +64,7 @@
* @author Andreas Schouten
* @author Anders Fugmann
*
* @version $Revision: 1.76 $ $Date: 2003/06/13 10:04:20 $
* @version $Revision: 1.77 $ $Date: 2003/06/13 16:15:55 $
*
* @see com.opencms.file.CmsObject
*/
Expand Down Expand Up @@ -112,34 +112,6 @@ public void acceptTask(String taskId) {
}
}

/**
* Checks, if the user may create this resource.
*
* @param resource the resource to check.
*/
public void accessCreate(String resource) {
try {
System.out.println(m_cms.accessCreate(resource));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}

/**
* Checks, if the user may lock this resource.
*
* @param resource the resource to check.
*/
public void accessLock(String resource) {
try {
System.out.println(m_cms.accessLock(resource));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}

/**
* Tests if the user can access the project.
*
Expand All @@ -155,20 +127,6 @@ public void accessProject(String id) {
}
}

/**
* Checks, if the user may read this resource.
*
* @param resource The resource to check.
*/
public void accessRead(String resource) {
try {
System.out.println(m_cms.accessRead(resource));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}

/**
* Tests if the user can write the resource.
*
Expand Down
40 changes: 30 additions & 10 deletions src/com/opencms/core/I_CmsConstants.java
@@ -1,7 +1,7 @@
/*
* File : $Source: /alkacon/cvs/opencms/src/com/opencms/core/Attic/I_CmsConstants.java,v $
* Date : $Date: 2003/06/13 10:04:20 $
* Version: $Revision: 1.231 $
* Date : $Date: 2003/06/13 16:15:55 $
* Version: $Revision: 1.232 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
Expand Down Expand Up @@ -40,7 +40,7 @@
* @author Michaela Schleich
* @author Thomas Weckert
*
* @version $Revision: 1.231 $ $Date: 2003/06/13 10:04:20 $
* @version $Revision: 1.232 $ $Date: 2003/06/13 16:15:55 $
*/
public interface I_CmsConstants {

Expand Down Expand Up @@ -366,22 +366,42 @@ public interface I_CmsConstants {
/**
* The permission to read a resource
*/
final static int C_PERMISSION_READ = 1;
int C_PERMISSION_READ = 1;

/**
* The permission to write a resource
*/
final static int C_PERMISSION_WRITE = 2;
int C_PERMISSION_WRITE = 2;

/**
* The permission to view a resource
*/
final static int C_PERMISSION_VIEW = 4;
int C_PERMISSION_VIEW = 4;

/**
* The permission to control a resource
*/
int C_PERMISSION_CONTROL = 8;

// Constants used for checking access
final static CmsPermissionSet C_READ_ACCESS = new CmsPermissionSet(I_CmsConstants.C_PERMISSION_READ);
final static CmsPermissionSet C_WRITE_ACCESS = new CmsPermissionSet(I_CmsConstants.C_PERMISSION_WRITE);
final static CmsPermissionSet C_VIEW_ACCESS = new CmsPermissionSet(I_CmsConstants.C_PERMISSION_VIEW);
/**
* Permission set to check read acces
*/
CmsPermissionSet C_READ_ACCESS = new CmsPermissionSet(C_PERMISSION_READ);

/**
* Permission set to check write access
*/
CmsPermissionSet C_WRITE_ACCESS = new CmsPermissionSet(C_PERMISSION_WRITE);

/**
* Permission set to check view access
*/
CmsPermissionSet C_VIEW_ACCESS = new CmsPermissionSet(C_PERMISSION_VIEW);

/**
* Permission set to check control access
*/
CmsPermissionSet C_CONTROL_ACCESS = new CmsPermissionSet(C_PERMISSION_CONTROL);

/**
* Group may read this resource
Expand Down
53 changes: 5 additions & 48 deletions src/com/opencms/file/CmsObject.java
@@ -1,7 +1,7 @@
/*
* File : $Source: /alkacon/cvs/opencms/src/com/opencms/file/Attic/CmsObject.java,v $
* Date : $Date: 2003/06/13 10:04:20 $
* Version: $Revision: 1.284 $
* Date : $Date: 2003/06/13 16:17:05 $
* Version: $Revision: 1.285 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
Expand Down Expand Up @@ -80,7 +80,7 @@
* @author Alexander Kandzior (a.kandzior@alkacon.com)
* @author Michaela Schleich
*
* @version $Revision: 1.284 $
* @version $Revision: 1.285 $
*/
public class CmsObject implements I_CmsConstants {

Expand Down Expand Up @@ -140,36 +140,7 @@ public CmsObject () {
public void acceptTask(int taskId) throws CmsException {
m_driverManager.acceptTask(m_context.currentUser(), m_context.currentProject(), taskId);
}
/**
* Checks, if the user may create this resource.
*
* @param resource the resource to check.
* @return <code>true</code> if the user has the appropriate rigths to create the resource; <code>false</code> otherwise
*
* @throws CmsException if operation was not successful.
*/
public boolean accessCreate(String resource) throws CmsException {
try {
return m_driverManager.accessCreate(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
} catch (Exception exc) {
throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
}
}
/**
* Checks, if the user may lock this resource.
*
* @param resource the resource to check.
* @return <code>true</code> if the user has the appropriate rights to lock this resource; <code>false</code> otherwise
*
* @throws CmsException if operation was not successful.
*/
public boolean accessLock(String resource) throws CmsException {
try {
return m_driverManager.accessLock(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
} catch (Exception exc) {
throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
}
}

/**
* Checks if the user can access the project.
*
Expand All @@ -181,21 +152,7 @@ public boolean accessLock(String resource) throws CmsException {
public boolean accessProject(int projectId) throws CmsException {
return (m_driverManager.accessProject(m_context.currentUser(), m_context.currentProject(), projectId));
}
/**
* Checks, if the user may read this resource.
*
* @param resource The resource to check.
* @return <code>true</code>, if the user has the appropriate rigths to read the resource; <code>false</code> otherwise.
*
* @throws CmsException if operation was not successful.
*/
public boolean accessRead(String resource) throws CmsException {
try {
return m_driverManager.accessRead(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
} catch (Exception exc) {
throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
}
}

/**
* Checks, if the user may write this resource.
*
Expand Down

0 comments on commit 93e36af

Please sign in to comment.