Package io.lumify.core.security

Source Code of io.lumify.core.security.LumifyVisibility

package io.lumify.core.security;

import org.securegraph.Visibility;

public class LumifyVisibility {
    public static final String SUPER_USER_VISIBILITY_STRING = "lumify";
    private final Visibility visibility;

    public LumifyVisibility() {
        this.visibility = new Visibility("");
    }

    public LumifyVisibility(String visibility) {
        if (visibility == null || visibility.length() == 0) {
            this.visibility = new Visibility("");
        } else {
            this.visibility = new Visibility("(" + visibility + ")|" + SUPER_USER_VISIBILITY_STRING);
        }
    }

    public Visibility getVisibility() {
        return visibility;
    }

    @Override
    public String toString() {
        return getVisibility().toString();
    }

    public static Visibility and(Visibility visibility, String additionalVisibility) {
        if (visibility.getVisibilityString().length() == 0) {
            return new Visibility(additionalVisibility);
        }
        return new Visibility("(" + visibility.getVisibilityString() + ")&(" + additionalVisibility + ")");
    }
}
TOP

Related Classes of io.lumify.core.security.LumifyVisibility

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.