2026-03-17 13:31:18 -07:00

160 lines
3.9 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package javax.baja.security;
import javax.baja.security.BPermissions;
import javax.baja.sys.Action;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Topic;
public final class AccessSlotCursor
implements SlotCursor {
SlotCursor c;
Context context;
public static final AccessSlotCursor make(SlotCursor slotCursor, Context context) {
return new AccessSlotCursor(slotCursor, context);
}
public final Context getContext() {
return this.context;
}
public final boolean next() {
while (this.c.next()) {
if (!this.has()) continue;
return true;
}
return false;
}
public final boolean nextObject() {
while (this.c.nextObject()) {
if (!this.has()) continue;
return true;
}
return false;
}
public final boolean nextComponent() {
while (this.c.nextComponent()) {
if (!this.has()) continue;
return true;
}
return false;
}
public final boolean next(Class clazz) {
while (this.c.next(clazz)) {
if (!this.has()) continue;
return true;
}
return false;
}
public final BObject target() {
return this.c.target();
}
public final Slot slot() {
return this.c.slot();
}
public final Property property() {
return this.c.property();
}
public final int getTypeAccess() {
return this.c.getTypeAccess();
}
public final BObject get() {
return this.c.get();
}
public final boolean getBoolean() {
return this.c.getBoolean();
}
public final int getInt() {
return this.c.getInt();
}
public final long getLong() {
return this.c.getLong();
}
public final float getFloat() {
return this.c.getFloat();
}
public final double getDouble() {
return this.c.getDouble();
}
public final String getString() {
return this.c.getString();
}
public final Action action() {
return this.c.action();
}
public final Topic topic() {
return this.c.topic();
}
private final boolean has() {
boolean bl;
Slot slot;
BComplex bComplex = (BComplex)this.c.target();
int n = bComplex.getFlags(slot = this.c.slot());
if ((n & 4) != 0) {
return false;
}
if (this.context == null) {
return true;
}
if (slot.isProperty() && this.c.getTypeAccess() == 7 && this.c.get().isComponent()) {
BComponent bComponent = this.c.get().asComponent();
return this.permissionsFor(bComponent).has(BPermissions.operatorRead);
}
BComponent bComponent = bComplex.isComponent() ? bComplex.asComponent() : bComplex.asComplex().getParentComponent();
BPermissions bPermissions = this.permissionsFor(bComponent);
boolean bl2 = false;
if ((n & 0x100) != 0) {
bl2 = bl = true;
}
if (slot.isAction()) {
if (bl) {
return bPermissions.has(4);
}
return bPermissions.has(64);
}
if (bl) {
return bPermissions.has(1);
}
return bPermissions.has(16);
}
private final BPermissions permissionsFor(BComponent bComponent) {
if (bComponent == null || this.context == null) {
return BPermissions.all;
}
return bComponent.getPermissions(this.context);
}
private AccessSlotCursor(SlotCursor slotCursor, Context context) {
this.c = slotCursor;
this.context = context;
}
}