AccessControlEntry.java 1.49 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.day.cq.wcm.msm.impl.actions.util;

import java.util.Arrays;

public class AccessControlEntry {
    private final String principalName;
    private final String[] privilegeNames;
    private final boolean isAllow;
    private final String restrictionPattern;

    public /* varargs */ AccessControlEntry(String principal, boolean allow, String restrictionPattern, String ... privilegeNames) {
        this.principalName = principal;
        this.privilegeNames = privilegeNames;
        this.isAllow = allow;
        this.restrictionPattern = restrictionPattern;
    }

    public AccessControlEntry(String newPrincipal, AccessControlEntry templateACE) {
        this(newPrincipal, templateACE.isAllow(), templateACE.getRestrictionPattern(), templateACE.getPrivilegeNames());
    }

    public String getPrincipalName() {
        return this.principalName;
    }

    public String[] getPrivilegeNames() {
        return this.privilegeNames;
    }

    public boolean isAllow() {
        return this.isAllow;
    }

    public String getRestrictionPattern() {
        return this.restrictionPattern;
    }

    public String toString() {
        Object[] arrobject = new Object[4];
        arrobject[0] = this.principalName;
        arrobject[1] = this.isAllow() ? "allows" : "denies";
        arrobject[2] = this.getRestrictionPattern();
        arrobject[3] = Arrays.toString(this.getPrivilegeNames());
        return String.format("ACE for %s %s %s %s", arrobject);
    }
}