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

com.floragunn.searchguard.privileges.PrivilegesEvaluatorResponse Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2015-2018 floragunn GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.floragunn.searchguard.privileges;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class PrivilegesEvaluatorResponse {
    boolean allowed = false;
    Set missingPrivileges = new HashSet();
    Map> allowedFlsFields;
    Map> maskedFields;
    Map> queries;
    PrivilegesEvaluatorResponseState state = PrivilegesEvaluatorResponseState.PENDING;
    
    public boolean isAllowed() {
        return allowed;
    }
    public Set getMissingPrivileges() {
        return new HashSet(missingPrivileges);
    }

    public Map> getAllowedFlsFields() {
        return allowedFlsFields;
    }
    
    public Map> getMaskedFields() {
        return maskedFields;
    }

    public Map> getQueries() {
        return queries;
    }
    
    public PrivilegesEvaluatorResponse markComplete() {
        this.state = PrivilegesEvaluatorResponseState.COMPLETE;
        return this;
    }

    public PrivilegesEvaluatorResponse markPending() {
        this.state = PrivilegesEvaluatorResponseState.PENDING;
        return this;
    }

    public boolean isComplete() {
        return this.state == PrivilegesEvaluatorResponseState.COMPLETE;
    }

    public boolean isPending() {
        return this.state == PrivilegesEvaluatorResponseState.PENDING;
    }

    @Override
    public String toString() {
        return "PrivEvalResponse [allowed=" + allowed + ", missingPrivileges=" + missingPrivileges
                + ", allowedFlsFields=" + allowedFlsFields + ", maskedFields=" + maskedFields + ", queries=" + queries + "]";
    }
    
    public static enum PrivilegesEvaluatorResponseState {
        PENDING,
        COMPLETE;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy