Search in sources :

Example 1 with Accessable

use of eu.ggnet.saft.api.auth.Accessable in project dwoss by gg-net.

the class SwingClient method enableAccessRestrictions.

private void enableAccessRestrictions(Collection<MetaAction> metaActions) {
    Guardian accessCos = Lookup.getDefault().lookup(Guardian.class);
    if (accessCos != null) {
        for (ActionFactory.MetaAction metaAction : metaActions) {
            if (metaAction.getAction() instanceof Accessable) {
                Accessable accessable = (Accessable) metaAction.getAction();
                accessCos.add(accessable);
            }
        }
    }
}
Also used : MetaAction(eu.ggnet.saft.core.cap.ActionFactory.MetaAction) Accessable(eu.ggnet.saft.api.auth.Accessable)

Example 2 with Accessable

use of eu.ggnet.saft.api.auth.Accessable in project dwoss by gg-net.

the class AbstractGuardian method setRights.

/**
 * This method set the Current {@link AtomicRight}'s to the given one and Enables/Disables all {@link Accessable} components.
 * <p>
 * @param dto is a {@link Operator} that will be setted.
 */
protected void setRights(Operator dto) {
    operator = dto;
    quickRights.put(dto.getQuickLoginKey(), dto);
    for (Accessable accessable : accessables) {
        accessable.setEnabled(false);
    }
    rights.clear();
    rights.addAll(dto.getRights());
    for (Accessable accessable : accessables) {
        for (AtomicRight atomicRight : dto.getRights()) {
            if (accessable.getNeededRight().equals(atomicRight))
                accessable.setEnabled(true);
        }
    }
    if (!StringUtils.isBlank(dto.getUsername())) {
        for (UserChangeListener listener : userChangeListeners) {
            listener.loggedIn(dto.getUsername());
        }
    }
}
Also used : AtomicRight(eu.ggnet.dwoss.rights.api.AtomicRight) Accessable(eu.ggnet.saft.api.auth.Accessable)

Aggregations

Accessable (eu.ggnet.saft.api.auth.Accessable)2 AtomicRight (eu.ggnet.dwoss.rights.api.AtomicRight)1 MetaAction (eu.ggnet.saft.core.cap.ActionFactory.MetaAction)1