Re: [smartweb-user] [auth] Create groups
Brought to you by:
rlogiacco
From: Roberto Lo G. <rlo...@sm...> - 2008-05-08 11:56:34
|
I think this is caused by a missing module configuration file which, in the current release is named smartweb.jar.xml and needs to be placed near by the smartweb.jar.hcf file (can you confirm this stefano?) I said _in the current release_ as in the next release it should be renamed to security.xml to make clear what's its purpose. Anyway I wish to suggest Stefano to add such informations to the module documentation as we have not mentioned anywhere the need for this configuration file nor we wrote where it should be placed or how it can be customized... even if we have an example file and some comments on it... which are not sufficient in my opinion. I'll try to contribute something and upload a new revision, but I think the real job will be performed by Stefano..... if he has time to spare for this! Thank you for your question..... this should become a FAQ in my honest opinion. 2008/5/8 Rocco Fusella <rfu...@sm...>: > I have to create a portal with two groups of users, I do not want to special > permits and privileges to them but only to distinguish a page from each > other and show then the code concerned. > I was trying to use this code but I do not know if they are on the right > track because me an error. Given the code is that the error for > completeness. > > Privilege read=new > Privilege(Privilege.STRING_ANY,Privilege.STRING_ANY,Privilege.READ); > Privilege write=new > Privilege(Privilege.STRING_ANY,Privilege.STRING_ANY,Privilege.WRITE); > Privilege execute=new > Privilege(Privilege.STRING_ANY,Privilege.STRING_ANY,Privilege.EXECUTE); > > Role admin=new Role("ruolo_amministratore","Ruolo > Amministratore"); > admin.add(read); > admin.add(write); > admin.add(execute); > RoleFactory.getInstance().update(admin); > > Role utente=new Role("ruolo_utente","Ruolo Utente"); > utente.add(read); > utente.add(execute); > RoleFactory.getInstance().update(utente); > > Permission pAdmin=new Permission(); > pAdmin.setRoleId(admin.getId()); > PermissionFactory.getInstance().update(pAdmin); > > Permission pUtente=new Permission(); > pUtente.setRoleId(utente.getId()); > PermissionFactory.getInstance().update(pUtente); > > Group gruppo1=new Group(); > gruppo1.setDescription("Amministratore Portale"); > gruppo1.setDisplay("Amministratore"); > gruppo1.add(pAdmin); > GroupFactory.getInstance().update(gruppo1); > > Group gruppo2=new Group(); > gruppo2.setDescription("Utente Registrato"); > gruppo2.setDisplay("Utente"); > gruppo2.add(pUtente); > GroupFactory.getInstance().update(gruppo2); > > User user1=new User(); > user1.setDisplay("admin"); > user1.setUsername("admin"); > user1.setPassword("admin"); > UserFactory.getInstance().update(user1); > > User user2=new User(); > user2.setDisplay("admin"); > user2.setUsername("admin"); > user2.setPassword("admin"); > UserFactory.getInstance().update(user2); > > user1.add(gruppo1); > user2.add(gruppo2); > UserFactory.getInstance().update(user2); > UserFactory.getInstance().update(user1); > > While this is the error code that generates me > > 453 WARN [main] net.smartlab.web.auth.RoleFactory - Configuration > Exception > net.smartlab.config.ConfigurationException: java.lang.NullPointerException > at > net.smartlab.config.XMLConfiguration.update(XMLConfiguration.java:174) > at net.smartlab.config.XMLConfiguration.<init>(XMLConfiguration.java:82) > at > net.smartlab.web.config.FileDomainConfigurationStrategy.getConfiguration(FileDomainConfigurationStrategy.java:48) > at net.smartlab.web.Domain.getConfiguration(Domain.java:160) > at net.smartlab.web.auth.RoleFactory.getInstance(RoleFactory.java:86) > at > net.smartlab.catalogo.GroupFactoryTest.testUpdate(GroupFactoryTest.java:48) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > Caused by: java.lang.NullPointerException > at > net.smartlab.config.XMLConfiguration.update(XMLConfiguration.java:171) > ... 18 more > java.lang.IllegalArgumentException: No destination bean specified > at > org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:217) > at > org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:114) > at net.smartlab.web.auth.RoleFactory.update(RoleFactory.java:154) > at > net.smartlab.catalogo.GroupFactoryTest.testUpdate(GroupFactoryTest.java:48) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) > 484 DEBUG [main] net.smartlab.catalogo.GroupFactoryTest - tearDown() - > start > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > > From what could depend? > Thank you. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > smartweb-user mailing list > sma...@li... > https://lists.sourceforge.net/lists/listinfo/smartweb-user > > -- Roberto Lo Giacco |