All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bazaarvoice.emodb.uac.api.InsufficientRolePermissionException Maven / Gradle / Ivy

package com.bazaarvoice.emodb.uac.api;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Exception thrown when a caller attempts to grant permissions for a role and the caller does not have
 * permission to grant the permissions.  The is different from receiving an
 * {@link com.bazaarvoice.emodb.common.api.UnauthorizedException}.  An UnauthorizedException indicates the caller
 * doesn't have permission to grant any permissions to the role.  This exception indicates the caller generally
 * has permission to grant permissions for the role but not the specific permission being attempted.  The same
 * applies when revoking permissions from a role.
 *
 * For example, assume API Key k1 has permission to grant any blob related permission to role r1, as
 * encompassed by the permission "blob|*".  If k1 attempted to grant "sor|read|*" to r1 it would
 * receive this exception.
 */
@JsonIgnoreProperties({"cause", "localizedMessage", "stackTrace"})
public class InsufficientRolePermissionException extends RuntimeException {

    private String _permission;

    public InsufficientRolePermissionException() {
        this("Insufficient permission to grant or revoke permission", null);
    }

    @JsonCreator
    public InsufficientRolePermissionException(@JsonProperty("message") String message, @JsonProperty("permission") String permission) {
        super(message);
        _permission = permission;
    }

    public String getPermission() {
        return _permission;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy