Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
angelborroy-ks committed May 31, 2017
0 parents commit dc2d7c7
Show file tree
Hide file tree
Showing 12 changed files with 585 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
simplify-share
==============

This add-on gives you the ability to hide Alfresco Share document library actions and regions to a specific group of users.

Users not in the group will not see configured actions (move, copy ...) in:

* Document Library
* Document Details

Users not in the group will not see regions (metadata, versions, workflows ...) in:

* Document Details

By default, the group the module looks for must have an ID of "GROUP_SIMPLE_USER". The display name can be anything. When you create the group you do not specify "GROUP_"--Alfresco will prepend that for you.

**This add-on does not changes the low-level permissions so that if someone figures out how to launch actions without the user interface, the repository tier let them do that**

Manual Installation
-------------------
There are only one AMP associated with this add-on. Is a "Share tier" AMP.

Use `mvn install` to create the AMP.

### Install the AMPs

You can install the AMPs as you normally would using the MMT. For example, to install on a server, you would copy `simplify-share-1.0.0.amp` to `$ALFRESCO_HOME/amps_share`, then run `bin/apply_amps.sh`.

Once the AMPs are deployed, start up Alfresco.

### Create and Populate the Group

Create a new group with an ID of "SIMPLE_USER". You can add individuals and groups to this group.
98 changes: 98 additions & 0 deletions simplify-share/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.keensoft</groupId>
<artifactId>simplify-share</artifactId>
<version>1.0.0</version>
<name>simplify-share AMP project</name>
<packaging>amp</packaging>
<description>Manages the lifecycle of the simplify-share AMP (Alfresco Module Package)</description>

<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-parent</artifactId>
<version>2.2.0</version>
</parent>

<!--
SDK properties have sensible defaults in the SDK parent,
but you can override the properties below to use another version.
For more available properties see the alfresco-sdk-parent POM.
-->
<properties>
<!-- The following are default values for data location and Alfresco version.
Uncomment if you need to change
<alfresco.version>${alfresco.community.default.version}</alfresco.version> -->

<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
<app.log.root.level>WARN</app.log.root.level>
-->

<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
<env>other environment name</env>
-->

<!-- The Maven artifact ID to use when loading the Share.WAR that the AMP should be applied to,
defaults to the alfresco.war artifact ID, so we need to override here. -->
<app.amp.client.war.artifactId>${alfresco.share.artifactId}</app.amp.client.war.artifactId>

<!-- Since Alfresco.WAR (i.e. the Repository) is already running on port 8080, we run Share.WAR on port 8081 -->
<maven.tomcat.port>8081</maven.tomcat.port>

<!-- Used in share-config-custom.xml. By default points to local installation of Alfresco Repo -->
<alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>

</properties>

<!-- Here we realize the connection with the Alfresco selected platform
(e.g.version and edition) -->
<dependencyManagement>
<dependencies>
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
(see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<!-- Following dependencies are needed for compiling Java code in src/main/java; -->
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share</artifactId>
<version>${alfresco.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.extensions.surf</groupId>
<artifactId>spring-surf-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Compress JavaScript files and store as *-min.js -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions simplify-share/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF

mvn clean install -Pamp-to-war
19 changes: 19 additions & 0 deletions simplify-share/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Note. This script requires Alfresco.war to be running in another Tomcat on port 8080

if [[ -z ${MAVEN_OPTS} ]]; then
echo "The environment variable 'MAVEN_OPTS' is not set, setting it for you";

# Downloads the spring-loaded lib if not existing and runs the Share AMP applied to Share WAR
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.5.RELEASE/springloaded-1.2.5.RELEASE.jar

if [ ! -f $springloadedfile ]; then
mvn validate -Psetup
fi

# Spring loaded can be used with the Share AMP project in 5.1
# (i.e. it does not have the same problem as Repo AMP and AIO)
MAVEN_OPTS="-javaagent:$springloadedfile -noverify"
fi
echo "MAVEN_OPTS is set to '$MAVEN_OPTS'";
mvn clean install -Pamp-to-war
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<extension>
<modules>
<module>
<id>Hide actions</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<evaluator type="group.module.evaluator">
<params>
<groups>GROUP_SIMPLE_USER</groups>
</params>
</evaluator>
<configurations>

<!--
Include any action from
https://github.com/Alfresco/share/blob/dff4098c2f193c9708f2735c12ef9374d7614ac6/share/src/main/resources/alfresco/share-documentlibrary-config.xml
to make it available to users from SIMPLE_USER group.
-->

<config evaluator="string-compare" condition="DocLibActions" replace="true">

<actionGroups>

<actionGroup id="document-browse">
<action index="100" id="document-download"/>
</actionGroup>

<actionGroup id="document-details">
</actionGroup>

<actionGroup id="folder-browse">
</actionGroup>

<actionGroup id="folder-details">
</actionGroup>

<actionGroup id="document-link-browse">
</actionGroup>

<actionGroup id="document-link-details">
</actionGroup>

<actionGroup id="folder-link-browse">
</actionGroup>

<actionGroup id="folder-link-details">
</actionGroup>

</actionGroups>
</config>

</configurations>
</module>
</modules>
</extension>
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<extension>
<modules>
<module>
<id>Hide components</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<evaluator type="group.module.evaluator">
<params>
<groups>GROUP_SIMPLE_USER</groups>
</params>
</evaluator>

<!-- Other components can be added in this file to hide them from Share web app -->

<components>
<component>
<scope>template</scope>
<region-id>document-actions</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<component>
<scope>template</scope>
<region-id>document-tags</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<component>
<scope>template</scope>
<region-id>document-metadata</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<component>
<scope>template</scope>
<region-id>document-workflows</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<component>
<scope>template</scope>
<region-id>document-versions</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<component>
<scope>template</scope>
<region-id>document-links</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hide">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
</components>

<!-- Required for custom toolbar at Document Library -->
<customizations>
<customization>
<targetPackageRoot>org.alfresco.components</targetPackageRoot>
<sourcePackageRoot>es.keensoft.components</sourcePackageRoot>
</customization>
</customizations>

</module>
</modules>
</extension>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<#--
Other regions can be included in this customization from
https://github.com/Alfresco/share/blob/master/share/src/main/resources/alfresco/site-webscripts/org/alfresco/components/documentlibrary/include/documentlist_v2.lib.ftl
Search for lines like <@markup id="documentListSortSelect"> and create a new line below:
<@region id="hideDocumentListSortSelect" target="documentListSortSelect" action="remove" scope="global"/>
-->

<@region id="hideFileSelect" target="fileSelect" action="remove" scope="global"/>
<@region id="hideCreateContent" target="createContent" action="remove" scope="global"/>
<@region id="hideUploadButton" target="uploadButton" action="remove" scope="global"/>
<@region id="hideSelectedItems" target="selectedItems" action="remove" scope="global"/>
14 changes: 14 additions & 0 deletions simplify-share/src/main/amp/file-mapping.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Custom AMP to WAR location mappings

#
# The following property can be used to include the standard set of mappings.
# The contents of this file will override any defaults. The default is
# 'true', i.e. the default mappings will be augmented or modified by values in
# this file.
#
include.default=true

#
# Custom mappings. If 'include.default' is false, then this is the complete set.
#
/web=/
Loading

0 comments on commit dc2d7c7

Please sign in to comment.