Hi I solved! the problem was that the userObject is onLine then I have to change it<div><div><div><br class="Apple-interchange-newline">public static String deleteUser(CmsObject cmso, String[] users){</div><div><br></div><div>
<span style="white-space:pre-wrap"> </span>try {</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>CmsObject userObject = OpenCms.initCmsObject(cmso);</div><div>
<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>LOG.info("Log user as Admin to delete users");</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>userObject.loginUser(Dictionary.USER_ADMIN,Dictionary.PASSWORD_ADMIN);</div>
</div></div><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><p class="p1"><b><span class="s4">if </span>( userObject.getRequestContext().currentProject().isOnlineProject() ){</b></p>
</div></div></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><div><p class="p1"><b>userObject.getRequestContext().setCurrentProject( userObject.readProject(<span class="s5">"Offline"</span>) );</b></p></div></div></div></blockquote></blockquote><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px">
<blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><p class="p1"><b> isOnline = <span class="s4">true</span>;</b></p></div></div></div></blockquote></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><p class="p1"><b>}</b></p></div></div></div></blockquote><div><div><div><p class="p1"><span class="Apple-tab-span"></span></p>
<p class="p1"><span class="Apple-tab-span"></span></p><p class="p1"><span class="Apple-tab-span"></span></p><p class="p3"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span></p>
</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>for(String user:users){</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>userObject.deleteUser(user);</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>}</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>return Dictionary.DELETE_OK;</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>} catch (CmsException e) {</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>e.printStackTrace();</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>return Dictionary.DELETE_KO;</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>}</div>
<div><br></div><div>}</div></div><div><br></div><div>Regards, Antoni</div><br><div class="gmail_quote">2012/4/19 Antoni Bertran <span dir="ltr"><<a href="mailto:tunyafix@gmail.com" target="_blank">tunyafix@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi I developed a module to manage users using OpenCMS Users, everything works fine but deleting user it does not work in 7.5.1 (we developed in 7.5.3 and works but production enviroment has 7.5.1</div>
<div><br></div><div>
<br></div><div>I get the error</div><div><br></div><div>org.opencms.file.CmsVfsException: Error al eliminar al usuario "<a href="mailto:xxxx@email.com" target="_blank">xxxx@email.com</a>".</div><div> at org.opencms.file.CmsVfsException.createException(CmsVfsException.java:80)</div>
<div><br></div><div> at org.opencms.db.CmsDbContext.throwException(CmsDbContext.java:238)</div><div> at org.opencms.db.CmsDbContext.report(CmsDbContext.java:212)</div><div><br></div><div> at org.opencms.db.CmsSecurityManager.deleteUser(CmsSecurityManager.java:5600)</div>
<div> at org.opencms.db.CmsSecurityManager.deleteUser(CmsSecurityManager.java:1503)</div><div> at org.opencms.file.CmsObject.deleteUser(CmsObject.java:1058)</div><div> at com.tresipunt.test.register.AdminAction.deleteUser(AdminAction.java:109)</div>
<div> at com.tresipunt.test.register.AdminAction.processAction(AdminAction.java:96)</div><div> at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.com_tresipunt_test.elements.administrator.userList_jsp._jspService(userList_jsp.java:137)</div>
<div><br></div><div> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)</div><div> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)</div><div> at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)</div>
<div><br></div><div> at org.opencms.db.CmsDbContext.throwException(CmsDbContext.java:238)</div><div> at org.opencms.db.CmsDbContext.report(CmsDbContext.java:212)</div><div><br></div><div> at org.opencms.db.CmsSecurityManager.deleteUser(CmsSecurityManager.java:5600)</div>
<div> at org.opencms.db.CmsSecurityManager.deleteUser(CmsSecurityManager.java:1503)ç</div><div> </div><div> </div><div><br></div><div>public static String deleteUser(CmsObject cmso, String[] users){</div>
<div><br></div><div><span style="white-space:pre-wrap"> </span>try {</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>CmsObject userObject = OpenCms.initCmsObject(cmso);</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>LOG.info("Log user as Admin to delete users");</div><div><span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>userObject.loginUser(Dictionary.USER_ADMIN,Dictionary.PASSWORD_ADMIN);</div><div><span style="white-space:pre-wrap"> </span></div><div>
<span style="white-space:pre-wrap"> </span>for(String user:users){</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>userObject.deleteUser(user);</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>}</div><div><span style="white-space:pre-wrap"> </span></div><div>
<span style="white-space:pre-wrap"> </span>return Dictionary.DELETE_OK;</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>} catch (CmsException e) {</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>e.printStackTrace();</div><div><span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>return Dictionary.DELETE_KO;</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>}</div>
<div><br></div><div>}</div><div><br></div><div>Before call our deleteUser we do:</div><div><br></div><div><span>if (cms.getRequestContext().currentProject().isOnlineProject()) {<br> cmso.loginUser("myadmin", "mypassword");<br>
cmso.getRequestContext().setCurrentProject(cmso.readProject("Offline"));<br> }</span></div><div><br></div><div>Thanks in advance!!!!</div><div><br></div><div>Regards!</div><span class="HOEnZb"><font color="#888888"><div>
Antoni</div><div>
<br></div>
</font></span></blockquote></div><br></div>