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

com.kero.security.lang.nodes.PropertyNode Maven / Gradle / Ivy

Go to download

Kero-Security is a library for statically controlling access to properties of objects / classes.

There is a newer version: 0.1.39
Show newest version
package com.kero.security.lang.nodes;

import java.util.List;
import java.util.Set;

import com.kero.security.core.agent.KeroAccessAgent;
import com.kero.security.core.property.Property;
import com.kero.security.core.role.storage.RoleStorage;
import com.kero.security.core.scheme.AccessScheme;
import com.kero.security.lang.nodes.metaline.PropertyMetalineBase;

public class PropertyNode extends KsdlNodeBase {

	private String name;
	private DefaultAccessNode defaultAccess;
	
	private Set grantRoles;
	private Set denyRoles;
	
	private List metalines;
	
	public PropertyNode(String name, DefaultAccessNode defaultAccess, Set grantRoles, Set denyRoles, List metalines) {
		
		this.name = name;
		this.defaultAccess = defaultAccess;
		
		this.grantRoles = grantRoles;
		this.denyRoles = denyRoles;
		this.metalines = metalines;
	}

	public void interpret(AccessScheme scheme) {

		KeroAccessAgent manager = scheme.getAgent();
		RoleStorage roleStorage = manager.getRoleStorage();
		
		Property prop = scheme.getOrCreateLocalProperty(this.name);

			defaultAccess.interpret(manager, prop);
			
			prop.grantRoles(roleStorage.getOrCreate(this.grantRoles));
			prop.denyRoles(roleStorage.getOrCreate(this.denyRoles));
			
			for(PropertyMetalineBase metaline : metalines) {
				
				metaline.interpret(manager, prop);
			}
	}
	
	public List getMetalines() {
		
		return this.metalines;
	}
	
	public Set getGrantRoles() {
		
		return this.grantRoles;
	}
	
	public Set getDenyRoles() {
	
		return this.denyRoles;
	}
	
	public DefaultAccessNode getDefaultAccess() {
		
		return this.defaultAccess;
	}
	
	public String getName() {
		
		return this.name;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy