<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<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 summary="" border="1" cellpadding="3" cellspacing="0"
width="100%">
<tbody>
<tr class="TableRowColor" bgcolor="white">
<td align="right" valign="top" 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
href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html"
title="class in org.opencms.file">CmsResource</a> resource, <a
href="http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html"
title="class in org.opencms.security">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 align="right" valign="top" 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
href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResource.html"
title="class in org.opencms.file">CmsResource</a> resource, <a
href="http://www.opencms.org/export/javadoc/core/org/opencms/security/CmsPermissionSet.html"
title="class in org.opencms.security">CmsPermissionSet</a> requiredPermissions,
boolean checkLock, <a
href="http://www.opencms.org/export/javadoc/core/org/opencms/file/CmsResourceFilter.html"
title="class in org.opencms.file">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>