CCM NG/ccm-cms: Fixed some test failures
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4701 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: a734e0eee7
pull/2/head
parent
1410e7fe3f
commit
95a2200327
|
|
@ -234,6 +234,7 @@ public class ContentItemManagerTest {
|
|||
"workflow_id"
|
||||
})
|
||||
public void createContentItem() {
|
||||
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo
|
||||
.findByLabel("info")
|
||||
|
|
@ -553,6 +554,7 @@ public class ContentItemManagerTest {
|
|||
"workflow_id"
|
||||
})
|
||||
public void moveItem() {
|
||||
|
||||
final Optional<ContentItem> item = itemRepo.findById(-10100L);
|
||||
assertThat(item.isPresent(), is(true));
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,11 @@ public class PermissionChecker {
|
|||
*/
|
||||
public boolean isPermitted(final String privilege) {
|
||||
if (subject.isAuthenticated()) {
|
||||
if (shiro.isSystemUser()) {
|
||||
return true;
|
||||
} else {
|
||||
return subject.isPermitted(generatePermissionString(privilege));
|
||||
}
|
||||
} else {
|
||||
return shiro.getPublicUser().isPermitted(generatePermissionString(
|
||||
privilege));
|
||||
|
|
@ -133,13 +137,16 @@ public class PermissionChecker {
|
|||
* @param object The object on which the privilege is granted.
|
||||
*
|
||||
* @return {@code true} if the there is a permission granting the provided
|
||||
* {@code privilege} on the provided {@code object} to the current
|
||||
* subject.
|
||||
* {@code privilege} on the provided {@code object} to the current subject.
|
||||
*/
|
||||
public boolean isPermitted(final String privilege, final CcmObject object) {
|
||||
if (subject.isAuthenticated()) {
|
||||
if (shiro.isSystemUser()) {
|
||||
return true;
|
||||
} else {
|
||||
return subject.isPermitted(generatePermissionString(
|
||||
privilege, object));
|
||||
}
|
||||
} else {
|
||||
return shiro.getPublicUser().isPermitted(generatePermissionString(
|
||||
privilege, object));
|
||||
|
|
@ -199,7 +206,9 @@ public class PermissionChecker {
|
|||
public void checkPermission(final String privilege)
|
||||
throws AuthorizationException {
|
||||
if (subject.isAuthenticated()) {
|
||||
if (!shiro.isSystemUser()) {
|
||||
subject.checkPermission(generatePermissionString(privilege));
|
||||
}
|
||||
} else {
|
||||
shiro.getPublicUser().checkPermission(generatePermissionString(
|
||||
privilege));
|
||||
|
|
@ -215,14 +224,17 @@ public class PermissionChecker {
|
|||
* @param object The object on which the privilege is granted.
|
||||
*
|
||||
* @throws AuthorizationException If there is no permission granting the
|
||||
* provided privilege to the current subject
|
||||
* on the provided object..
|
||||
* provided privilege to the current subject on the provided object..
|
||||
*/
|
||||
public void checkPermission(final String privilege,
|
||||
final CcmObject object)
|
||||
throws AuthorizationException {
|
||||
|
||||
if (subject.isAuthenticated()) {
|
||||
subject.checkPermission(generatePermissionString(privilege, object));
|
||||
if (!shiro.isSystemUser()) {
|
||||
subject.checkPermission(generatePermissionString(privilege,
|
||||
object));
|
||||
}
|
||||
} else {
|
||||
shiro.getPublicUser().checkPermission(generatePermissionString(
|
||||
privilege, object));
|
||||
|
|
|
|||
Loading…
Reference in New Issue