[opencms-dev] CmsObject.hasPermissions & CmsObject.readResource

Joe Lam joe.lam at moni-media.net
Wed Sep 27 08:25:49 CEST 2006


Hi all,

I wanna execute hasPermissions before I read a resource. my problem is 
hasPermissions requires CmsResource as parameter.
|boolean| 	|*hasPermissions 
<http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsObject.html#hasPermissions%28org.opencms.file.CmsResource,%20org.opencms.security.CmsPermissionSet%29>*(CmsResource 
<http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html> resource, 
CmsPermissionSet 
<http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html> requiredPermissions)| 

          Checks if the current user has required permissions to access 
a given resource.
| boolean| 	|*hasPermissions 
<http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsObject.html#hasPermissions%28org.opencms.file.CmsResource,%20org.opencms.security.CmsPermissionSet,%20boolean,%20org.opencms.file.CmsResourceFilter%29>*(CmsResource 
<http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html> resource, 
CmsPermissionSet 
<http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html> requiredPermissions, 
boolean checkLock, CmsResourceFilter 
<http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResourceFilter.html> filter)| 



How can I check the current user's permission b4 I read the resource?

if I do
CmsResource res=cmso.readResource(uri, 
CmsResourceFilter.ONLY_VISIBLE_NO_DELETED );
I got run time error when someone has no read permission on that resource.
I think I should do hasPermissions check (or something similar) first.

please help

Thanks
Joe Lam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060927/6ec8921a/attachment.htm>


More information about the opencms-dev mailing list