it can be customized... even if we have an example file and some
comments on it... which are not sufficient in my opinion.
think the real job will be performed by Stefano..... if he has time to
Thank you for your question..... this should become a FAQ in my honest opinion.
> 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
>
smartweb-user@...
>
https://lists.sourceforge.net/lists/listinfo/smartweb-user>
>
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.