]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/auth/SystemRole.java
1 package org
.argeo
.cms
.auth
;
5 import javax
.security
.auth
.Subject
;
6 import javax
.xml
.namespace
.QName
;
8 import org
.argeo
.api
.cms
.CmsConstants
;
9 import org
.argeo
.cms
.internal
.auth
.ImpliedByPrincipal
;
11 public interface SystemRole
{
14 default boolean implied(Subject subject
, String context
) {
15 return implied(getName(), subject
, context
);
18 static boolean implied(QName name
, Subject subject
, String context
) {
19 Set
<ImpliedByPrincipal
> roles
= subject
.getPrincipals(ImpliedByPrincipal
.class);
20 for (ImpliedByPrincipal role
: roles
) {
21 if (role
.isSystemRole()) {
22 if (role
.getRoleName().equals(name
)) {
23 // !! if context is not specified, it is considered irrelevant
26 if (role
.getContext().equalsIgnoreCase(context
)
27 || role
.getContext().equals(CmsConstants
.NODE_BASEDN
))