Search in sources :

Example 1 with UserDomainInterfaceOperationKey

use of io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey in project joynr by bmwcarit.

the class LocalDomainAccessControllerImpl method getConsumerPermission.

@Override
@CheckForNull
public void getConsumerPermission(final String userId, final String domain, final String interfaceName, final TrustLevel trustLevel, final GetConsumerPermissionCallback callback) {
    final UserDomainInterfaceOperationKey subscriptionKey = new UserDomainInterfaceOperationKey(null, domain, interfaceName, null);
    LOG.debug("getConsumerPermission on domain {}, interface {}", domain, interfaceName);
    // Handle special cases which should not require a lookup or a subscription
    Permission specialPermission = handleSpecialCases(domain, interfaceName);
    if (specialPermission != null) {
        callback.getConsumerPermission(specialPermission);
        return;
    }
    if (subscriptionsMap.get(subscriptionKey) == null) {
        if (!ongoingSubscriptions.contains(subscriptionKey)) {
            queryDomainRoles(userId);
            queryAccessControlEntries(domain, interfaceName, new QueryAccessControlEntriesCallback() {

                @Override
                public void queryAccessControlEntriesSucceeded() {
                    subscriptionsMap.put(subscriptionKey, subscribeForAceChange(domain, interfaceName));
                    ongoingSubscriptions.remove(subscriptionKey);
                    getConsumerPermissionWithCachedEntries(userId, domain, interfaceName, trustLevel, callback);
                }

                @Override
                public void queryAccessControlEntriesFailed() {
                    callback.getConsumerPermissionFailed();
                }
            });
        }
    } else {
        getConsumerPermissionWithCachedEntries(userId, domain, interfaceName, trustLevel, callback);
    }
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) UserDomainInterfaceOperationKey(io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey) CheckForNull(javax.annotation.CheckForNull)

Example 2 with UserDomainInterfaceOperationKey

use of io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey in project joynr by bmwcarit.

the class DomainAccessControlStoreEhCache method updateOwnerAccessControlEntry.

@Override
public Boolean updateOwnerAccessControlEntry(OwnerAccessControlEntry updatedOwnerAce) {
    boolean updateSuccess = false;
    MasterAccessControlEntry masterAce = getMasterAccessControlEntry(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
    MasterAccessControlEntry mediatorAce = getMediatorAccessControlEntry(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
    AceValidator aceValidator = new AceValidator(masterAce, mediatorAce, updatedOwnerAce);
    if (aceValidator.isOwnerValid()) {
        UserDomainInterfaceOperationKey aceKey = new UserDomainInterfaceOperationKey(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
        updateSuccess = updateAce(updatedOwnerAce, CacheId.OWNER_ACL, aceKey);
    }
    return updateSuccess;
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) UserDomainInterfaceOperationKey(io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)

Example 3 with UserDomainInterfaceOperationKey

use of io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey in project joynr by bmwcarit.

the class DomainAccessControlStoreEhCache method updateMediatorAccessControlEntry.

@Override
public Boolean updateMediatorAccessControlEntry(MasterAccessControlEntry updatedMediatorAce) {
    boolean updateSuccess = false;
    MasterAccessControlEntry masterAce = getMasterAccessControlEntry(updatedMediatorAce.getUid(), updatedMediatorAce.getDomain(), updatedMediatorAce.getInterfaceName(), updatedMediatorAce.getOperation());
    AceValidator aceValidator = new AceValidator(masterAce, updatedMediatorAce, null);
    if (aceValidator.isMediatorValid()) {
        UserDomainInterfaceOperationKey aceKey = new UserDomainInterfaceOperationKey(updatedMediatorAce.getUid(), updatedMediatorAce.getDomain(), updatedMediatorAce.getInterfaceName(), updatedMediatorAce.getOperation());
        updateSuccess = updateAce(updatedMediatorAce, CacheId.MASTER_ACL, aceKey);
    }
    return updateSuccess;
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) UserDomainInterfaceOperationKey(io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)

Example 4 with UserDomainInterfaceOperationKey

use of io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey in project joynr by bmwcarit.

the class DomainAccessControlStoreEhCache method updateMasterAccessControlEntry.

@Override
public Boolean updateMasterAccessControlEntry(MasterAccessControlEntry updatedMasterAce) {
    boolean updateSuccess = false;
    UserDomainInterfaceOperationKey aceKey = new UserDomainInterfaceOperationKey(updatedMasterAce.getUid(), updatedMasterAce.getDomain(), updatedMasterAce.getInterfaceName(), updatedMasterAce.getOperation());
    updateSuccess = updateAce(updatedMasterAce, CacheId.MASTER_ACL, aceKey);
    return updateSuccess;
}
Also used : UserDomainInterfaceOperationKey(io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)

Example 5 with UserDomainInterfaceOperationKey

use of io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey in project joynr by bmwcarit.

the class LocalDomainAccessControllerImpl method unsubscribeFromAceChanges.

@Override
public void unsubscribeFromAceChanges(String domain, String interfaceName) {
    UserDomainInterfaceOperationKey subscriptionKey = new UserDomainInterfaceOperationKey(null, domain, interfaceName, null);
    AceSubscription subscriptions = subscriptionsMap.get(subscriptionKey);
    if (subscriptions != null) {
        try {
            globalDomainAccessControllerClient.unsubscribeFromMasterAccessControlEntryChangedBroadcast(subscriptions.getMasterSubscriptionId());
            globalDomainAccessControllerClient.unsubscribeFromMediatorAccessControlEntryChangedBroadcast(subscriptions.getMediatorSubscriptionId());
            globalDomainAccessControllerClient.unsubscribeFromOwnerAccessControlEntryChangedBroadcast(subscriptions.getOwnerSubscriptionId());
        } catch (JoynrRuntimeException | InterruptedException | ApplicationException e) {
            LOG.warn("unsubscribe from AceChanges failed due to the following error: {}", e.getMessage());
            return;
        }
    } else {
        /*
             * This can be the case, when no consumer request has been performed during the lifetime of the provider
             */
        LOG.debug("Subscription for ace subscription for interface '{}' domain '{}' not found", interfaceName, domain);
    }
}
Also used : ApplicationException(joynr.exceptions.ApplicationException) UserDomainInterfaceOperationKey(io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException)

Aggregations

UserDomainInterfaceOperationKey (io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)5 MasterAccessControlEntry (joynr.infrastructure.DacTypes.MasterAccessControlEntry)2 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 CheckForNull (javax.annotation.CheckForNull)1 ApplicationException (joynr.exceptions.ApplicationException)1 Permission (joynr.infrastructure.DacTypes.Permission)1