src/main/java/za/co/grindrodbank/dokuti/document/DocumentServiceImpl.java
private DocumentEntity addDocumentCreatorPermissionsToDocument(DocumentEntity document)
			throws DatabaseLayerException {
		UUID creatorUserId = UUID.fromString(SecurityContextUtility.getUserIdFromJwt());
		logger.debug("Obtained the following UUID from the security context to use as the document creator: {}",
				creatorUserId);
		// Create a list of all the possible DocumentPermissions ENUM values, as we want
		// to assign all the available permissions to to the document creator.
		List<DocumentPermission> allDocumentPermissions = new ArrayList<>(
				EnumSet.allOf(DocumentPermission.class));

		try {
			allDocumentPermissions.forEach(permissionValue -> {
				logger.debug("Adding the {} permission to Document {} for user {}", permissionValue,
						document.getId(), creatorUserId);
				document.addPermission(creatorUserId, permissionValue, true, creatorUserId);
			});

			documentRepository.save(document);

			return document;
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw new DatabaseLayerException("Error saving document after assinging document ACL permissions.", e);
		}
	}
/**
	 * Creates and adds all the permissions that a document creator gets to the
	 * document.
	 * 
	 * @param document The document to add all the creator permissions to.
	 * @return An updated instance of the document that the permissions were added
	 *         to.
	 * @throws DatabaseLayerException
	 */
Creates and adds all the permissions that a document creator gets to the
document.

@param document The document to add all the creator permissions to.
@return An updated instance of the document that the permissions were added
to.
Creates and adds all the permissions that a document creator gets to the document . @param document The document to add all the creator permissions to . @return An updated instance of the document that the permissions were added to .
private DocumentEntity addDocumentCreatorPermissionsToDocument(DocumentEntity document)
			throws DatabaseLayerException {
		UUID creatorUserId = UUID.fromString(SecurityContextUtility.getUserIdFromJwt());
		logger.debug("Obtained the following UUID from the security context to use as the document creator: {}",
				creatorUserId);
		List<DocumentPermission> allDocumentPermissions = new ArrayList<>(
				EnumSet.allOf(DocumentPermission.class));
		try {
			allDocumentPermissions.forEach(permissionValue -> {
				logger.debug("Adding the {} permission to Document {} for user {}", permissionValue,
						document.getId(), creatorUserId);
				document.addPermission(creatorUserId, permissionValue, true, creatorUserId);
			});
			documentRepository.save(document);
			return document;
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw new DatabaseLayerException("Error saving document after assinging document ACL permissions.", e);
		}
	}
private DocumentEntity addDocumentCreatorPermissionsToDocument ( DocumentEntity document ) throws DatabaseLayerException { UUID creatorUserId = UUID . fromString ( SecurityContextUtility . getUserIdFromJwt ( ) ) ; logger . debug ( "Obtained the following UUID from the security context to use as the document creator: {}" , creatorUserId ) ; List < DocumentPermission > allDocumentPermissions = new ArrayList < > ( EnumSet . allOf ( DocumentPermission . class ) ) ; try { allDocumentPermissions . forEach ( permissionValue -> { logger . debug ( "Adding the {} permission to Document {} for user {}" , permissionValue , document . getId ( ) , creatorUserId ) ; document . addPermission ( creatorUserId , permissionValue , true , creatorUserId ) ; } ) ; documentRepository . save ( document ) ; return document ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; throw new DatabaseLayerException ( "Error saving document after assinging document ACL permissions." , e ) ; } }
Creates and adds all the permissions that a document creator gets to the
 document.
Creates and adds all the permissions that a document creator gets to the document .
// Create a list of all the possible DocumentPermissions ENUM values, as we want // to assign all the available permissions to to the document creator.