<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=672333506-27092006><FONT face=Arial 
color=#0000ff size=2>As far as I remember, I just tried to read the resource and 
caught the Exception which arose when it wasn't possible - there didn't seem to 
be a better way.  Maybe I didn't look hard enough, but it works 
fine.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=672333506-27092006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=672333506-27092006><FONT face=Arial 
color=#0000ff size=2>Jon</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-bounces@opencms.org 
[mailto:opencms-dev-bounces@opencms.org] <B>On Behalf Of </B>Joe 
Lam<BR><B>Sent:</B> 27 September 2006 07:26<BR><B>To:</B> 
opencms-dev@opencms.org<BR><B>Subject:</B> [opencms-dev] 
CmsObject.hasPermissions & CmsObject.readResource<BR></FONT><BR></DIV>
<DIV></DIV><SMALL><FONT face=Verdana>Hi all,<BR><BR>I wanna execute 
hasPermissions before I read a resource. my problem is 
</FONT></SMALL><SMALL><FONT face=Verdana>hasPermissions requires CmsResource as 
parameter.<BR></FONT></SMALL>
<TABLE cellSpacing=0 cellPadding=3 width="100%" summary="" border=1>
  <TBODY>
  <TR class=TableRowColor bgColor=white>
    <TD vAlign=top align=right width="1%"><FONT 
      size=-1><CODE>boolean</CODE></FONT></TD>
    <TD><CODE><B><A 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsObject.html#hasPermissions%28org.opencms.file.CmsResource,%20org.opencms.security.CmsPermissionSet%29">hasPermissions</A></B>(<A 
      title="class in org.opencms.file" 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html">CmsResource</A> resource, 
      <A title="class in org.opencms.security" 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html">CmsPermissionSet</A> requiredPermissions)</CODE> 
      <BR>          Checks if 
      the current user has required permissions to access a given 
resource.</TD></TR>
  <TR class=TableRowColor bgColor=white>
    <TD vAlign=top align=right width="1%"><FONT 
      size=-1><CODE> boolean</CODE></FONT></TD>
    <TD><CODE><B><A 
      href="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">hasPermissions</A></B>(<A 
      title="class in org.opencms.file" 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html">CmsResource</A> resource, 
      <A title="class in org.opencms.security" 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html">CmsPermissionSet</A> requiredPermissions, 
      boolean checkLock, <A title="class in org.opencms.file" 
      href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResourceFilter.html">CmsResourceFilter</A> filter)</CODE> 
    </TD></TR></TBODY></TABLE><BR><SMALL><FONT face=Verdana>How can I check the 
current user's permission b4 I read the resource?<BR><BR>if I do<BR>CmsResource 
res=cmso.readResource(uri, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED );<BR>I got 
run time error when someone has no read permission on that resource.<BR>I think 
I should do hasPermissions check (or something similar) first.<BR><BR>please 
help<BR><BR>Thanks<BR>Joe Lam<BR></FONT></SMALL></BODY></HTML>