Skip to content

Commit

Permalink
Improvements in README and minor whitespace adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiliavir committed Apr 21, 2021
1 parent 123b17b commit 31845aa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 43 deletions.
29 changes: 23 additions & 6 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
# digital-signature

[![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)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2e7111f7beb84222bdf07f8fc3c788f9)](https://app.codacy.com/app/baloise/digital-signature?utm_source=github.com&utm_medium=referral&utm_content=baloise/digital-signature&utm_campaign=Badge_Grade_Dashboard)

A macro for Atlassian Confluence
A digital signature macro for [Atlassian Confluence](https://www.atlassian.com/software/confluence)

## Description
Allows you to enter a contract into a confluence macro and to sign it as logged in user.
Allows confluence users to write contracts in a confluence macro which can be signed directly by logged-in users.
- 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

## Privacy Policy
- We do not transfer or store any data outside your Atlassian product.
- We have no access to any data you stored within your Atlassian product.
- Your data is yours - no strings attached.

## 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)
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
Expand All @@ -36,7 +42,18 @@ A detailed description of the available configuration fields and usage is descri
![](./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)
## Contribute
Keep it simple: every contribution is welcome. Either if you report an issue, help on solving one, or contribute to the
solution by adding a Pull Request.

For a more detailed answer on best practices and guidelines please have a look at our [open source community](https://github.com/baloise/open-source) at Baloise.

## Credits
This macro was written by [Matthias Cullmann](@culmat).
It is maintained in the Open Source Community at Baloise.

## License
This project is licensed under the [Apache-2.0 License](https://github.com/baloise/digital-signature/blob/master/LICENSE).

## Releases
[Build Artifacts](https://github.com/baloise/digital-signature/tree/gh-pages/release)
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
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 java.util.*;

import org.apache.velocity.tools.generic.DateTool;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -50,6 +33,13 @@
import com.atlassian.user.GroupManager;
import com.atlassian.user.search.page.Pager;

import static com.atlassian.confluence.renderer.radeox.macros.MacroUtils.defaultVelocityContext;
import static com.atlassian.confluence.security.ContentPermission.*;
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;

@Scanned
public class DigitalSignatureMacro implements Macro {
private final int MAX_MAILTO_CHARACTER_COUNT = 500;
Expand Down Expand Up @@ -185,15 +175,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);
}
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(new TreeSet<>());
if (!signaturesVisible) signature.setSignatures(new HashMap<String, Date>());
if (!signaturesVisible) signature.setSignatures(new HashMap<>());
return pendingVisible && signaturesVisible;
}

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

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import org.junit.Test;

public class SignatureTest {

@Test
public void testClone() throws Exception {
Signature signature = new Signature(999, "title", "body");
signature.getMissingSignatures().add("Hans");
Signature cloned = signature.clone();
assertFalse(signature == cloned);
assertEquals(signature, cloned);
assertEquals("Hans", cloned.getMissingSignatures().iterator().next());
}

}
@Test
public void testClone() throws Exception {
Signature signature = new Signature(999, "title", "body");
signature.getMissingSignatures().add("Hans");
Signature cloned = signature.clone();
assertFalse(signature == cloned);
assertEquals(signature, cloned);
assertEquals("Hans", cloned.getMissingSignatures().iterator().next());
}
}

0 comments on commit 31845aa

Please sign in to comment.