use of org.apache.wiki.auth.permissions.AllPermission in project jspwiki by apache.
the class AuthorizationManagerTest method testAdminView.
@Test
public void testAdminView() throws Exception {
m_engine.saveText("TestDefaultPage", "Foo [{ALLOW view FooBar}]");
Principal admin = new GroupPrincipal("Admin");
WikiSession session = WikiSessionTest.containerAuthenticatedSession(m_engine, Users.ALICE, new Principal[] { admin });
Assert.assertTrue("Alice has AllPermission", m_auth.checkPermission(session, new AllPermission(m_engine.getApplicationName())));
Assert.assertTrue("Alice cannot read", m_auth.checkPermission(session, new PagePermission("TestDefaultPage", "view")));
}
use of org.apache.wiki.auth.permissions.AllPermission in project jspwiki by apache.
the class UserManager method initialize.
/**
* Initializes the engine for its nefarious purposes.
* @param engine the current wiki engine
* @param props the wiki engine initialization properties
*/
public void initialize(WikiEngine engine, Properties props) {
m_engine = engine;
// Attach the PageManager as a listener
// TODO: it would be better if we did this in PageManager directly
addWikiEventListener(engine.getPageManager());
// TODO: Replace with custom annotations. See JSPWIKI-566
WikiAjaxDispatcherServlet.registerServlet(JSON_USERS, new JSONUserModule(this), new AllPermission(null));
}
Aggregations