<?xml version="1.0" encoding="UTF-8"?>
<ajxp_plugin enabled="false" label="CONF_MESSAGE[Encfs Mount]" description="CONF_MESSAGE[Dynamically create/mount/umount an encfs filesystem]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
    <plugin_info>
        <core_relation packaged="true" tested_version="8.0"/>
        <plugin_author>Charles du Jeu</plugin_author>
    </plugin_info>
    <client_settings>
        <resources>
            <i18n namespace="encfs" path="plugins/cypher.encfs/resources/i18n"/>
            <js className="EncFSActions" file="plugins/cypher.encfs/res/build/EncFSActions.js"/>
        </resources>
    </client_settings>
    <server_settings>
        <global_param description="CONF_MESSAGE[Full path on the server to a pre-generated .encfs6.xml file]"
                      label="CONF_MESSAGE[Encfs XML File]"
                      name="ENCFS_XML_TEMPLATE" type="string" mandatory="true"/>
        <global_param description="CONF_MESSAGE[Password used when generating the encfs6.xml file]"
                      label="CONF_MESSAGE[Encfs Password]" name="ENCFS_XML_PASSWORD"
                      type="string" mandatory="true" />
        <global_param description="CONF_MESSAGE[User ID for the web accessing user (apache, www-data,...).]"
                      label="CONF_MESSAGE[UID]" name="ENCFS_UID"
                      type="integer" mandatory="true" default="33"/>
    </server_settings>
    <class_definition classname="Pydio\Action\Cypher\EncfsMounter" filename="plugins/cypher.encfs/EncfsMounter.php"/>
    <registry_contributions>
        <actions>
            <action name="encfs.cypher_folder_create">
                <gui src="cypher.encfs/ICON_SIZE/encrypted.png" iconClass="icon-credit-card" text="encfs.5" title="encfs.6" hasAccessKey="false">
                    <context dir="false" recycle="false" selection="true" actionBar="true" actionBarGroup="other" contextMenu="true"/>
                    <selectionContext dir="true" file="false" recycle="false" unique="true" evalMetadata="!metadata.get('ENCFS_clear_folder')"/>
                </gui>
                <processing>
                    <clientCallback  module="EncFSActions.Callbacks.createCypheredFolder"/>
                </processing>
            </action>
            <action name="encfs.cypher_folder">
                <gui src="cypher.encfs/ICON_SIZE/encrypted.png" iconClass="icon-credit-card" text="encfs.1" title="encfs.2" hasAccessKey="false">
                    <context dir="false" recycle="false" selection="true" actionBar="false" contextMenu="true" actionBarGroup="other"/>
                    <selectionContext dir="true" file="false" recycle="false" unique="true" evalMetadata="metadata.get('ENCFS_clear_folder_mounted')"/>
                </gui>
                <processing>
                    <clientCallback module="EncFSActions.Callbacks.cypherFolder"/>
                    <serverCallback methodName="switchAction" restParams="/dir+" developerComment="Cypher a folder using EncFS plugin">
                        <input_param name="dir" type="path" description="Path to the directory to encrypt"/>
                        <input_param name="pass" type="string" description="Password for first encryption. Next calls, pass is not necessary, folder will just be unmounted."/>
                    </serverCallback>
                </processing>
            </action>
            <action name="encfs.uncypher_folder">
                <gui src="cypher.encfs/ICON_SIZE/encrypted.png" iconClass="icon-credit-card" text="encfs.3" title="encfs.4" hasAccessKey="false">
                    <context dir="false" recycle="false" selection="true" actionBar="false" contextMenu="true" actionBarGroup="other"/>
                    <selectionContext dir="true" file="false" recycle="false" unique="true" evalMetadata="metadata.get('ENCFS_clear_folder') &amp;&amp; !metadata.get('ENCFS_clear_folder_mounted')"/>
                </gui>
                <processing>
                    <clientCallback module="EncFSActions.Callbacks.uncypherFolder"/>
                    <serverCallback methodName="switchAction" restParams="/dir+" developerComment="Decrypt a folder using EncFS plugin.">
                        <input_param name="dir" type="path" description="Path to the directory to encrypt" mandatory="true"/>
                        <input_param name="pass" type="string" description="Password used at encrytion time" mandatory="true"/>
                    </serverCallback>
                </processing>
            </action>
            <action name="move">
                <pre_processing>
                    <serverCallback methodName="preProcessMove"/>
                </pre_processing>
            </action>
            <action name="delete">
                <pre_processing>
                    <serverCallback methodName="preProcessMove"/>
                </pre_processing>
            </action>
            <action name="restore">
                <pre_processing>
                    <serverCallback methodName="preProcessMove"/>
                </pre_processing>
            </action>
            <action name="logout">
                <pre_processing>
                    <serverCallback methodName="cypherAllMounted"/>
                </pre_processing>
            </action>
            <action name="switch_repository">
                <pre_processing>
                    <serverCallback methodName="cypherAllMounted"/>
                </pre_processing>
            </action>
        </actions>
        <hooks>
            <serverCallback methodName="filterENCFS" hookName="node.info.nocache"/>
        </hooks>
    </registry_contributions>
    <dependencies>
        <activePlugin pluginName="access.fs"/>
    </dependencies>
</ajxp_plugin>
