Skip to content

Commit

Permalink
Merge pull request #67 from baloise/master
Browse files Browse the repository at this point in the history
Release 7.0.3
  • Loading branch information
Tiliavir committed Mar 24, 2021
2 parents 9d584cb + 123b17b commit 4b1bb18
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 132 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI

on:
push:
branches: [ master, release ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Build with Maven
run: mvn -B package --file pom.xml
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
create:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Source 🛎️
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '11'

- name: Build with Maven 🔧
run: mvn -B package --file pom.xml

- name: Copy artifacts
run: |
mkdir artifacts
cp target/*.jar artifacts/
cp target/*.obr artifacts/
rm artifacts/*-tests.jar
ls artifacts
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
path: artifacts

- name: Get tag name
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/*/} | tr / -)" >> $GITHUB_ENV

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: artifacts
CLEAN: false
TARGET_FOLDER: ${{ env.TAG_NAME }}
COMMIT_MESSAGE: Releasing tag/branch ${{ env.TAG_NAME }}
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

46 changes: 0 additions & 46 deletions Jenkinsfile

This file was deleted.

37 changes: 33 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,39 @@

A macro for Atlassian Confluence

Install via [marketplace.atlassian.com](https://marketplace.atlassian.com/plugins/com.baloise.confluence.digital-signature)
## Description
Allows you to enter a contract into a confluence macro and to sign it as logged in user.
- content and signatures can not be modified once signed
- white list users who can sign
- report when and by whom the contract was signed
- easily send email to signers of the contract
- receive notifications, when your contract was signed

## Builds
## Installation & Usage
Install via [Atlassian Marketplace](https://marketplace.atlassian.com/plugins/com.baloise.confluence.digital-signature).

A detailed description of the available configuration fields and usage is described in the [Wiki...](https://github.com/baloise/digital-signature/wiki/Signature-Macro-Usage)

## Feature overview
### Insert / edit macro
![](./docs/img/contract_text.png)
![](./docs/img/edit.png)

### Sign
![](./docs/img/sign.png)

### [release](https://github.com/baloise/digital-signature/tree/gh-pages/release) [![Build Status](https://travis-ci.org/baloise/digital-signature.svg?branch=release)](https://travis-ci.org/baloise/digital-signature/branches)
- Set signers, title notified users and layout of the contract
- One click approval. User management is done by Confluence.
- The signature remains valid only as long the title and body are the same as at the time of signature.

### Markdown
![](./docs/img/markdown.png)

### Mail notification
![](./docs/img/report_email_export.png)
![](./docs/img/send_mail.png.png)

## Builds
[![CI Build State](https://github.com/baloise/digital-signature/workflows/CI/badge.svg)](https://github.com/baloise/digital-signature/actions?query=workflow%3A%22CI%22)

### [master](https://github.com/baloise/digital-signature/tree/gh-pages/master) [![Build Status](https://travis-ci.org/baloise/digital-signature.svg?branch=master)](https://travis-ci.org/baloise/digital-signature/branches)
[Build Artifacts](https://github.com/baloise/digital-signature/tree/gh-pages/release)
4 changes: 2 additions & 2 deletions README.RELEASE.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
- `mvn clean package`
- merge onto release branch
- set tag
- push and wait for https://travis-ci.org/baloise/digital-signature/branches to succeed
- create a version in marketplace https://marketplace.atlassian.com/manage/plugins/com.baloise.confluence.digital-signature/versions and upload obr (from https://github.com/baloise/digital-signature/tree/gh-pages/release)
- push and wait for the [![ReleaseAction](https://github.com/baloise/digital-signature/workflows/Release/badge.svg)](https://github.com/baloise/digital-signature/actions?query=workflow%3A%22Release%22) to succeed
- create a version in the [atlssian marketplace](https://marketplace.atlassian.com/manage/plugins/com.baloise.confluence.digital-signature/versions) and upload obr from [GitHub Pages](https://github.com/baloise/digital-signature/tree/gh-pages/release).
Binary file added docs/img/contract_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/markdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/report_email_export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/send_mail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 5 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.baloise.confluence</groupId>
<artifactId>digital-signature</artifactId>
<version>7.0.2</version>
<version>7.0.3</version>
<organization>
<name>Baloise</name>
<url>http://www.baloise.ch/</url>
Expand Down Expand Up @@ -102,10 +102,10 @@
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down Expand Up @@ -220,47 +220,4 @@
<url>https://packages.atlassian.com/mvn/maven-external/</url>
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<merge>true</merge>
<repositoryOwner>baloise</repositoryOwner>
<repositoryName>${project.artifactId}</repositoryName>
<message>Releasing ${project.version}</message>
<path>${env.TRAVIS_BRANCH}</path>
<includes>
<include>${project.build.finalName}.jar</include>
<include>${project.build.finalName}.obr</include>
</includes>
<outputDirectory>target</outputDirectory>
<oauth2Token>${env.github_oauth2Token}</oauth2Token>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
package com.baloise.confluence.digitalsignature;

import static com.atlassian.confluence.renderer.radeox.macros.MacroUtils.defaultVelocityContext;
import static com.atlassian.confluence.security.ContentPermission.EDIT_PERMISSION;
import static com.atlassian.confluence.security.ContentPermission.VIEW_PERMISSION;
import static com.atlassian.confluence.security.ContentPermission.createUserPermission;
import static com.atlassian.confluence.setup.bandana.ConfluenceBandanaContext.GLOBAL_CONTEXT;
import static com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.InvalidParameterException;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;

import org.apache.velocity.tools.generic.DateTool;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;

import com.atlassian.bandana.BandanaManager;
import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.core.ContentEntityObject;
Expand All @@ -23,25 +49,6 @@
import com.atlassian.user.Group;
import com.atlassian.user.GroupManager;
import com.atlassian.user.search.page.Pager;
import org.apache.velocity.tools.generic.DateTool;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.InvalidParameterException;
import java.util.*;

import static com.atlassian.confluence.renderer.radeox.macros.MacroUtils.defaultVelocityContext;
import static com.atlassian.confluence.security.ContentPermission.EDIT_PERMISSION;
import static com.atlassian.confluence.security.ContentPermission.VIEW_PERMISSION;
import static com.atlassian.confluence.security.ContentPermission.createUserPermission;
import static com.atlassian.confluence.setup.bandana.ConfluenceBandanaContext.GLOBAL_CONTEXT;
import static com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static java.util.stream.Collectors.toList;

@Scanned
public class DigitalSignatureMacro implements Macro {
Expand Down Expand Up @@ -178,10 +185,15 @@ private void ensureProtectedPage(ConversionContext conversionContext, Page page,
}

private boolean hideSignatures(Map<String, String> params, Signature signature, String currentUserName) {
try {
signature = signature.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(e);
}
boolean pendingVisible = isVisible(signature, currentUserName, params.get("pendingVisible"));
boolean signaturesVisible = isVisible(signature, currentUserName, params.get("signaturesVisible"));
if (!pendingVisible) signature.setMissingSignatures(emptySet());
if (!signaturesVisible) signature.setSignatures(emptyMap());
if (!pendingVisible) signature.setMissingSignatures(new TreeSet<>());
if (!signaturesVisible) signature.setSignatures(new HashMap<String, Date>());
return pendingVisible && signaturesVisible;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.baloise.confluence.digitalsignature;

import java.io.Serializable;
import java.util.*;

import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;

public class Signature implements Serializable {
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

public class Signature implements Serializable, Cloneable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -83,7 +87,7 @@ public void setSignatures(Map<String, Date> signatures) {
}

public Set<String> getMissingSignatures() {
return missingSignatures;
return missingSignatures;
}

public void setMissingSignatures(Set<String> missingSignatures) {
Expand Down Expand Up @@ -191,4 +195,9 @@ public boolean isSignatory(String userName) {
public boolean hasMissingSignatures() {
return !isMaxSignaturesReached() && (isPetitionMode() || !getMissingSignatures().isEmpty());
}

@Override
public Signature clone() throws CloneNotSupportedException{
return (Signature) super.clone();
}
}
2 changes: 1 addition & 1 deletion src/main/resources/digital-signature.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ com.baloise.confluence.digital-signature.signature.macro.panel.export.label=Expo
com.baloise.confluence.digital-signature.signature.macro.panel.email.label=Send e-mail to signatories
com.baloise.confluence.digital-signature.signature.macro.panel.email.menu.already-signed=Completed signatories
com.baloise.confluence.digital-signature.signature.macro.panel.email.menu.not-yet-signed=Pending signatories
com.baloise.confluence.digital-signature.signature.macro.warning.bodyToShort=You need to enter at least 10 characters of text to be signed.
com.baloise.confluence.digital-signature.signature.macro.warning.bodyToShort=Please enter at least 10 characters of text to be signed. You can type into the macro's body, once added to a page.
com.baloise.confluence.digital-signature.signature.macro.warning.editPermissionRequiredForProtectedContent=You need to {0}restrict{1} page access and have at least one edit permission in order to allow protected content.
com.baloise.confluence.digital-signature.signature.service.error.badUser={0} is not expected to sign document {1}
com.baloise.confluence.digital-signature.signature.service.message.label.withNames=With names
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/digital-signature_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ com.baloise.confluence.digital-signature.signature.macro.panel.export.label=Gesc
com.baloise.confluence.digital-signature.signature.macro.panel.email.label=Email an Unterzeichnende
com.baloise.confluence.digital-signature.signature.macro.panel.email.menu.already-signed=Bereits unterzeichnet
com.baloise.confluence.digital-signature.signature.macro.panel.email.menu.not-yet-signed=Noch nicht unterzeichnet
com.baloise.confluence.digital-signature.signature.macro.warning.bodyToShort=Geben Sie mindesten 10 Zeichen Text ein.
com.baloise.confluence.digital-signature.signature.macro.warning.bodyToShort=Bitte geben Sie mindesten 10 Zeichen zu signierenden Text ein. Sie können diesen direkt im Macro eingeben, sobald dieses auf einer Seite platziert ist.
com.baloise.confluence.digital-signature.signature.macro.warning.editPermissionRequiredForProtectedContent=Die müssen das Bearbeiten der Seite {0}beschränken{1} um eine geschütze Unterseite zu erstellen.
com.baloise.confluence.digital-signature.signature.service.error.badUser=Es wird nicht erwartet, dass {0} {1} unterzeichnet.
com.baloise.confluence.digital-signature.signature.service.message.label.withNames=Mit Namen
Expand Down
Loading

0 comments on commit 4b1bb18

Please sign in to comment.