Search in sources :

Example 1 with ConfigurableUserGroupProvider

use of org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider in project nifi-registry by apache.

the class AuthorizerCapabilityDetection method isConfigurableUserGroupProvider.

public static boolean isConfigurableUserGroupProvider(final Authorizer authorizer) {
    if (!isManagedAuthorizer(authorizer)) {
        return false;
    }
    final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
    final AccessPolicyProvider accessPolicyProvider = managedAuthorizer.getAccessPolicyProvider();
    return accessPolicyProvider.getUserGroupProvider() instanceof ConfigurableUserGroupProvider;
}
Also used : ManagedAuthorizer(org.apache.nifi.registry.security.authorization.ManagedAuthorizer) ConfigurableUserGroupProvider(org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider) AccessPolicyProvider(org.apache.nifi.registry.security.authorization.AccessPolicyProvider) ConfigurableAccessPolicyProvider(org.apache.nifi.registry.security.authorization.ConfigurableAccessPolicyProvider)

Example 2 with ConfigurableUserGroupProvider

use of org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider in project nifi-registry by apache.

the class AuthorizationService method updateUserGroup.

public UserGroup updateUserGroup(UserGroup userGroup) {
    verifyUserGroupProviderIsConfigurable();
    writeLock.lock();
    try {
        final org.apache.nifi.registry.security.authorization.Group updatedGroup = ((ConfigurableUserGroupProvider) userGroupProvider).updateGroup(userGroupFromDTO(userGroup));
        if (updatedGroup == null) {
            return null;
        }
        return userGroupToDTO(updatedGroup);
    } finally {
        writeLock.unlock();
    }
}
Also used : Group(org.apache.nifi.registry.security.authorization.Group) ConfigurableUserGroupProvider(org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider)

Example 3 with ConfigurableUserGroupProvider

use of org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider in project nifi-registry by apache.

the class AuthorizationService method deleteUserGroup.

public UserGroup deleteUserGroup(String identifier) {
    verifyUserGroupProviderIsConfigurable();
    writeLock.lock();
    try {
        final UserGroup userGroupDTO = getUserGroup(identifier);
        if (userGroupDTO != null) {
            ((ConfigurableUserGroupProvider) userGroupProvider).deleteGroup(identifier);
        }
        return userGroupDTO;
    } finally {
        writeLock.unlock();
    }
}
Also used : ConfigurableUserGroupProvider(org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider) UserGroup(org.apache.nifi.registry.authorization.UserGroup)

Example 4 with ConfigurableUserGroupProvider

use of org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider in project nifi-registry by apache.

the class AuthorizationService method deleteUser.

public User deleteUser(String identifier) {
    verifyUserGroupProviderIsConfigurable();
    this.writeLock.lock();
    try {
        User deletedUserDTO = getUser(identifier);
        if (deletedUserDTO != null) {
            ((ConfigurableUserGroupProvider) userGroupProvider).deleteUser(identifier);
        }
        return deletedUserDTO;
    } finally {
        this.writeLock.unlock();
    }
}
Also used : User(org.apache.nifi.registry.authorization.User) NiFiUser(org.apache.nifi.registry.security.authorization.user.NiFiUser) CurrentUser(org.apache.nifi.registry.authorization.CurrentUser) ConfigurableUserGroupProvider(org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider)

Example 5 with ConfigurableUserGroupProvider

use of org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider in project nifi-registry by apache.

the class AuthorizerCapabilityDetection method isGroupConfigurable.

public static boolean isGroupConfigurable(final Authorizer authorizer, final Group group) {
    if (!isConfigurableUserGroupProvider(authorizer)) {
        return false;
    }
    final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
    final ConfigurableUserGroupProvider configurableUserGroupProvider = (ConfigurableUserGroupProvider) managedAuthorizer.getAccessPolicyProvider().getUserGroupProvider();
    return configurableUserGroupProvider.isConfigurable(group);
}
Also used : ManagedAuthorizer(org.apache.nifi.registry.security.authorization.ManagedAuthorizer) ConfigurableUserGroupProvider(org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider)

Aggregations

ConfigurableUserGroupProvider (org.apache.nifi.registry.security.authorization.ConfigurableUserGroupProvider)7 ManagedAuthorizer (org.apache.nifi.registry.security.authorization.ManagedAuthorizer)3 Group (org.apache.nifi.registry.security.authorization.Group)2 CurrentUser (org.apache.nifi.registry.authorization.CurrentUser)1 User (org.apache.nifi.registry.authorization.User)1 UserGroup (org.apache.nifi.registry.authorization.UserGroup)1 AccessPolicyProvider (org.apache.nifi.registry.security.authorization.AccessPolicyProvider)1 ConfigurableAccessPolicyProvider (org.apache.nifi.registry.security.authorization.ConfigurableAccessPolicyProvider)1 NiFiUser (org.apache.nifi.registry.security.authorization.user.NiFiUser)1