Package org.rundeck.app.acl
Class BaseContextACLManager<T>
- java.lang.Object
-
- org.rundeck.app.acl.BaseContextACLManager<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
ContextACLManager<T>
,ContextValidator<T>
- Direct Known Subclasses:
ContextACLStorageFileManager
public abstract class BaseContextACLManager<T> extends java.lang.Object implements ContextACLManager<T>
Base context acl manager, usesforContext(Object)
to retrieve ACLFilemanager, and apply corresponding method call, maintains created managers in a map, and handles listener mappings for the created managers
-
-
Constructor Summary
Constructors Constructor Description BaseContextACLManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addListener(T context, ACLFileManagerListener listener)
Receive notification of changesvoid
addListenerMap(java.util.function.Function<T,ACLFileManagerListener> mapping)
adds a mapping from context to listeners, and immediately applies to previously created managersprotected ACLFileManager
applyMappings(T ctx, ACLFileManager listenable)
Applies existing listener mappings to a managerprotected abstract ACLFileManager
createManager(T context)
boolean
deletePolicyFile(T context, java.lang.String fileName)
Delete a policy fileboolean
existsPolicyFile(T context, java.lang.String file)
ACLFileManager
forContext(T context)
AclPolicyFile
getAclPolicy(T context, java.lang.String fileName)
Retrieve a system policyjava.lang.String
getPolicyFileContents(T context, java.lang.String fileName)
java.util.List<java.lang.String>
listStoredPolicyFiles(T context)
List the system aclpolicy file names, not including the dir pathlong
loadPolicyFileContents(T context, java.lang.String fileName, java.io.OutputStream outputStream)
Load content to output streamvoid
removeListener(T context, ACLFileManagerListener listener)
Remove a listenerlong
storePolicyFile(T context, java.lang.String fileName, java.io.InputStream input)
Store a system policy filelong
storePolicyFileContents(T context, java.lang.String fileName, java.lang.String fileText)
Store a system policy filecom.dtolabs.rundeck.core.authorization.RuleSetValidation<com.dtolabs.rundeck.core.authorization.providers.PolicyCollection>
validatePolicyFile(T context, java.lang.String fname)
Validate the yaml aclpolicy within a specific project contextcom.dtolabs.rundeck.core.authorization.RuleSetValidation<com.dtolabs.rundeck.core.authorization.providers.PolicyCollection>
validateYamlPolicy(T context, java.lang.String ident, java.lang.String text)
Validate the yaml aclpolicy, optionally within a specific project context
-
-
-
Method Detail
-
applyMappings
protected ACLFileManager applyMappings(T ctx, ACLFileManager listenable)
Applies existing listener mappings to a manager- Parameters:
ctx
- contextlistenable
- manager
-
createManager
protected abstract ACLFileManager createManager(T context)
- Returns:
- create a manager based on context
-
forContext
public ACLFileManager forContext(T context)
- Specified by:
forContext
in interfaceContextACLManager<T>
-
addListenerMap
public void addListenerMap(java.util.function.Function<T,ACLFileManagerListener> mapping)
adds a mapping from context to listeners, and immediately applies to previously created managers- Specified by:
addListenerMap
in interfaceContextACLManager<T>
- Parameters:
mapping
-
-
addListener
public void addListener(T context, ACLFileManagerListener listener)
Description copied from interface:ContextACLManager
Receive notification of changes- Specified by:
addListener
in interfaceContextACLManager<T>
-
removeListener
public void removeListener(T context, ACLFileManagerListener listener)
Description copied from interface:ContextACLManager
Remove a listener- Specified by:
removeListener
in interfaceContextACLManager<T>
-
storePolicyFile
public long storePolicyFile(T context, java.lang.String fileName, java.io.InputStream input) throws java.io.IOException
Description copied from interface:ContextACLManager
Store a system policy file- Specified by:
storePolicyFile
in interfaceContextACLManager<T>
fileName
- name without pathinput
- input stream- Returns:
- size of bytes stored
- Throws:
java.io.IOException
-
deletePolicyFile
public boolean deletePolicyFile(T context, java.lang.String fileName) throws java.io.IOException
Description copied from interface:ContextACLManager
Delete a policy file- Specified by:
deletePolicyFile
in interfaceContextACLManager<T>
- Returns:
- true if successful
- Throws:
java.io.IOException
-
storePolicyFileContents
public long storePolicyFileContents(T context, java.lang.String fileName, java.lang.String fileText) throws java.io.IOException
Description copied from interface:ContextACLManager
Store a system policy file- Specified by:
storePolicyFileContents
in interfaceContextACLManager<T>
fileName
- name without pathfileText
- contents- Returns:
- size of bytes stored
- Throws:
java.io.IOException
-
getAclPolicy
public AclPolicyFile getAclPolicy(T context, java.lang.String fileName)
Description copied from interface:ContextACLManager
Retrieve a system policy- Specified by:
getAclPolicy
in interfaceContextACLManager<T>
fileName
- name without path- Returns:
- definition
-
getPolicyFileContents
public java.lang.String getPolicyFileContents(T context, java.lang.String fileName) throws java.io.IOException
- Specified by:
getPolicyFileContents
in interfaceContextACLManager<T>
fileName
- name of policy file, without path- Returns:
- text contents of the policy file
- Throws:
java.io.IOException
-
loadPolicyFileContents
public long loadPolicyFileContents(T context, java.lang.String fileName, java.io.OutputStream outputStream) throws java.io.IOException
Description copied from interface:ContextACLManager
Load content to output stream- Specified by:
loadPolicyFileContents
in interfaceContextACLManager<T>
fileName
- name of policy file, without path- Returns:
- length of output
- Throws:
java.io.IOException
-
existsPolicyFile
public boolean existsPolicyFile(T context, java.lang.String file)
- Specified by:
existsPolicyFile
in interfaceContextACLManager<T>
file
- name without path- Returns:
- true if the policy file with the given name exists
-
validateYamlPolicy
public com.dtolabs.rundeck.core.authorization.RuleSetValidation<com.dtolabs.rundeck.core.authorization.providers.PolicyCollection> validateYamlPolicy(T context, java.lang.String ident, java.lang.String text) throws java.io.IOException
Description copied from interface:ContextValidator
Validate the yaml aclpolicy, optionally within a specific project context- Specified by:
validateYamlPolicy
in interfaceContextValidator<T>
ident
- identity string for the sourcestext
- yaml aclpolicy text- Returns:
- validation
- Throws:
java.io.IOException
-
validatePolicyFile
public com.dtolabs.rundeck.core.authorization.RuleSetValidation<com.dtolabs.rundeck.core.authorization.providers.PolicyCollection> validatePolicyFile(T context, java.lang.String fname) throws java.io.IOException
Description copied from interface:ContextValidator
Validate the yaml aclpolicy within a specific project context- Specified by:
validatePolicyFile
in interfaceContextValidator<T>
fname
- filename- Returns:
- validation
- Throws:
java.io.IOException
-
listStoredPolicyFiles
public java.util.List<java.lang.String> listStoredPolicyFiles(T context)
Description copied from interface:ContextACLManager
List the system aclpolicy file names, not including the dir path- Specified by:
listStoredPolicyFiles
in interfaceContextACLManager<T>
-
-