use of org.xwiki.security.authorization.AccessDeniedException in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method currentUserHasNotAdminRight.
/**
* @return the exception expected when the current user has the not the admin right
*/
private Exception currentUserHasNotAdminRight() throws AccessDeniedException {
WikiReference wiki = new WikiReference("wikiId");
Exception exception = new AccessDeniedException(Right.ADMIN, currentUserRef, wiki);
doThrow(exception).when(authorizationManager).checkAccess(eq(Right.ADMIN), eq(currentUserRef), eq(wiki));
return exception;
}
use of org.xwiki.security.authorization.AccessDeniedException in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method currentScriptHasNotProgrammingRight.
/**
* @return the exception expected when the current script has the not the programing right
*/
private Exception currentScriptHasNotProgrammingRight() throws AccessDeniedException {
DocumentReference authorDocRef = new DocumentReference("mainWiki", "XWiki", "Admin");
when(currentDoc.getAuthorReference()).thenReturn(authorDocRef);
DocumentReference currentDocRef = new DocumentReference("subwiki", "Test", "test");
when(currentDoc.getDocumentReference()).thenReturn(currentDocRef);
Exception exception = new AccessDeniedException(Right.PROGRAM, authorDocRef, currentDocRef);
doThrow(exception).when(authorizationManager).checkAccess(Right.PROGRAM, authorDocRef, currentDocRef);
return exception;
}
use of org.xwiki.security.authorization.AccessDeniedException in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method currentUserHasNotCreateWikiRight.
/**
* @return the exception expected when the current user has the not the 'create wiki' right
*/
private Exception currentUserHasNotCreateWikiRight() throws AccessDeniedException {
WikiReference wiki = new WikiReference("mainWiki");
Exception exception = new AccessDeniedException(Right.CREATE_WIKI, currentUserRef, wiki);
doThrow(exception).when(authorizationManager).checkAccess(eq(Right.CREATE_WIKI), eq(currentUserRef), eq(wiki));
return exception;
}
Aggregations