Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding standards, database standards, and performance pass #15

Open
wants to merge 81 commits into
base: 8.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
adec5f5
column rename
May 12, 2020
591a721
nodes as entities
May 12, 2020
bef8612
doesn't seem necessary
May 12, 2020
01a721b
return array
May 14, 2020
fb8127d
more null vs array issues
May 29, 2020
a4ad7ab
missing same level of precision on form
Jun 8, 2020
6041a19
much simpler migration
Jun 19, 2020
1dc3b3f
replacing with safer insert query
Jun 19, 2020
1bf7e10
Merge pull request #1 from qadan/column_rename
adam-vessey Jun 22, 2020
b472870
Merge pull request #2 from qadan/node_entities
adam-vessey Jun 22, 2020
320a098
Merge pull request #3 from qadan/null-check
adam-vessey Jun 22, 2020
202aefd
update readme, fix issues
Jun 29, 2020
469f4d2
fix logging
Jun 30, 2020
5dca542
issue with the form not having a preselected node
Jun 30, 2020
1c61f42
closing brace
Jul 2, 2020
f1598e4
Merge pull request #5 from qadan/updates
IAMlKeno Jul 2, 2020
629095a
first pass at coding standards overhaul
Jul 9, 2020
a094ceb
some more cleanup, making configs work
Jul 9, 2020
007f968
all the little random translation and markup and injection issues
Jul 10, 2020
20181e8
and a host of fixes
Jul 10, 2020
7bbdddc
and re-run coding standards
Jul 10, 2020
5c01fc6
nasty ksm hiding in there
Jul 13, 2020
d498679
null default
Jul 13, 2020
e68defa
fixes for things
Jul 20, 2020
cefe830
default for ranges query
Jul 21, 2020
f3c9d00
random issues with random forms and random screens
Jul 21, 2020
e85d1cb
move some schema stuff, generate ids
Jul 24, 2020
19c563b
missing a thing
Jul 24, 2020
f8a3714
Merge pull request #6 from qadan/coding-standards
JojoVes Jul 24, 2020
966d91d
overhaul the redirect thingy
Jul 28, 2020
eb9940c
Adding use statements to condition.
MorganDawe Jul 29, 2020
44ed00a
Merge pull request #8 from MorganDawe/8.x-ir-144
Jul 29, 2020
fff5ba1
:Merge branch '8.x-1.x' of github.com:discoverygarden/embargoes into …
Jul 29, 2020
beb7dc9
check contents of ranges
Jul 30, 2020
149bcbd
cast to array since cant be sure whats in the param
Jul 30, 2020
136824c
readme and licensing
Jul 30, 2020
12227da
log view
Jul 30, 2020
d3253d0
add field plugin
Jul 30, 2020
d5d7785
Merge pull request #7 from qadan/coding-standards
JojoVes Jul 30, 2020
2a24e54
Merge branch '8.x-1.x' of github.com:discoverygarden/embargoes into e…
Jul 30, 2020
b69619d
coding standards
Jul 30, 2020
1f23513
checking for actual entities before redirect
Jul 31, 2020
4e2dc29
cache tags and contexts
Jul 31, 2020
b60890d
Merge branch 'entity-checks' of github.com:qadan/embargoes into embar…
Jul 31, 2020
47ba163
cache tag all the things also fixes
Jul 31, 2020
0ac5e56
more caching stuff
Jul 31, 2020
4569395
Merge pull request #10 from qadan/entity-checks
jordandukart Aug 4, 2020
3b1e2a6
add the dang template, string stuff
Aug 4, 2020
aae7232
fixing behaviour
Aug 5, 2020
ad63c0a
repairs
Aug 5, 2020
1ff0ba0
Merge pull request #9 from qadan/embargoes-logs
JojoVes Aug 5, 2020
d8ab1f0
readme stuff
Aug 6, 2020
d007dcd
check embargoed status on files
Aug 6, 2020
ecc03dc
more updates
Aug 7, 2020
a007625
merge conflicts
Aug 7, 2020
fb1e8f1
check images
Aug 7, 2020
141b3ad
entity config shenanigans in the background
Aug 7, 2020
b9e773d
coder fixes
Aug 7, 2020
c1718da
Merge pull request #11 from qadan/behaviour-fixes
JojoVes Aug 7, 2020
acb654c
Adding new embargoes block.
MorganDawe Aug 11, 2020
a7770c3
Merge branch '8.x-1.x' of github.com:discoverygarden/embargoes into 8…
MorganDawe Aug 11, 2020
41debf3
Adding new embargoes notification block.
MorganDawe Aug 13, 2020
246a615
Bringing up to date with head.
MorganDawe Aug 13, 2020
e10507b
fix issue of setting expiration date for indefinite embargoes
JojoVes Aug 14, 2020
ab6cdcd
make sure the contact message is added for nodes that don't have any …
JojoVes Aug 18, 2020
cd50724
Merge pull request #12 from MorganDawe/8.x-ir-121
Aug 31, 2020
a0054cd
update embargo admin permission
Aug 31, 2020
a6ed5c0
cache issue, fixing readmes
Sep 1, 2020
9472b82
Merge pull request #13 from qadan/embargo-admin-permission
IAMlKeno Sep 1, 2020
0f45848
fixing
lutaylor Sep 21, 2020
5da21b4
Merge pull request #14 from lutaylor/wmcupdate
adam-vessey Sep 21, 2020
f1e924f
empty nids array is returned if no relationships
nchiasson-dgi Jan 20, 2021
3b6905b
Merge pull request #15 from nchiasson-dgi/8.x-1.x-return_empty_nids_a…
jordandukart Jan 21, 2021
ab1cbe2
D9 compat.
jordandukart Feb 19, 2021
005732d
Don't create entities when the IP range is invalid.
jordandukart Feb 19, 2021
5f6827d
Don't use messenger.
jordandukart Mar 9, 2021
e3da2d7
Merge pull request #17 from jordandukart/8.x-1.x
adam-vessey Mar 10, 2021
201a111
Adding a default message for embargo notification block
IAMlKeno Jun 1, 2021
bfaf078
Merge pull request #18 from IAMlKeno/dgi8-63
JojoVes Jun 2, 2021
25892c8
Fix for missing entity configuration in Drupal 9
nigelgbanks Jun 21, 2021
40f23eb
Merge pull request #19 from nigelgbanks/fixes-for-drupal-9
jordandukart Jun 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
# Embargoes
Drupal 8 module for managing embargo policies with access restrictions on content

Adds the ability to manage embargo policies with access restrictions on content.

## Requirements
Embargoes requires no other Drupal modules to work.

This module requires the following modules/libraries:

* [Menu UI](https://www.drupal.org/docs/core-modules-and-themes/core-modules/menu-ui-module)

## Installation

Install as
[usual](https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules).

## Configuration

Configuration options can be set at `admin/config/content/embargoes/settings`,
including notification options and IP range settings that can apply to
embargoes.

To add an IP range for use on embargoes, navigate to
`admin/config/content/embargoes/settings/ips` and click 'Add IP range'. Ranges
created via this method can then be used as IP address whitelists when creating
embargoes.

## Usage

### Applying an embargo

An embargo can be applied to an existing node by navigating to
`node/{node_id}/embargoes`. From here, an embargo can be applied if it doesn't
already exist, and existing embargoes can be modified or removed.

## Maintainers/Sponsors

* [FSU Library](https://github.com/fsulib/embargoes)
* [discoverygarden](http://support.discoverygarden.ca)

## License
[GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt)
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"keywords": ["Drupal"],
"homepage": "https://github.com/fsulib/embargoes",
"license": "GPL-2.0+",
"replace": {
"drupal/embargoes":"*"
},
"authors": [
{
"name": "Bryan J. Brown",
Expand Down
4 changes: 4 additions & 0 deletions config/install/embargoes.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
embargo_contact_email: null
add_contact_to_notifications: true
show_embargo_message: true
80 changes: 80 additions & 0 deletions config/schema/embargoes.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,83 @@ condition.plugin.embargoes_embargoed_condition:
filter:
type: text
label: 'Embargo Filter'

embargoes.settings:
type: config_object
mapping:
embargo_contact_email:
type: email
label: 'Contact email for embargo notifications'
add_contact_to_notifications:
type: boolean
label: 'Whether to add contact information to embargo notifications'
show_embargo_message:
type: boolean
label: 'Whether to display an embargo warning on embargoed nodes'

embargoes.embargoes_embargo_entity.*:
type: config_entity
label: 'Embargo config'
mapping:
id:
type: string
label: 'ID'
embargo_type:
type: boolean
label: 'Embargo Type'
expiration_type:
type: boolean
label: 'Expiration Type'
expiration_date:
type: string
label: 'Expiration Date'
exempt_ips:
type: string
label: 'Exempt IP Ranges'
nullable: true
exempt_users:
type: sequence
label: 'Exempt Users'
sequence:
type: mapping
mapping:
target_id:
type: integer
additional_emails:
type: sequence
label: 'Additional Emails'
sequence:
type: mapping
mapping:
additional_email:
type: string
embargoed_node:
type: integer
label: 'Embargoed Node'
notification_status:
type: integer
label: 'Notification Status'

embargoes.embargoes_ip_range_entity.*:
type: config_entity
label: 'IP Range config'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Label'
ranges:
type: sequence
label: 'Ranges'
sequence:
type: mapping
mapping:
range:
type: string
proxy_url:
type: string
label: 'Proxy URL'
uuid:
type: string
36 changes: 0 additions & 36 deletions config/schema/embargoes_embargo_entity.schema.yml

This file was deleted.

18 changes: 0 additions & 18 deletions config/schema/embargoes_ip_range_entity.schema.yml

This file was deleted.

43 changes: 35 additions & 8 deletions embargoes.install
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

/**
* @file
* Install, update and uninstall functions for the embargoes module.
*/
* @file
* Install, update and uninstall functions for the embargoes module.
*/

use Drupal\Core\Database\Database;

/**
* Implements hook_schema().
*/
* Implements hook_schema().
*/
function embargoes_schema() {
$schema['embargoes_log'] = [
'description' => 'Embargo log table.',
Expand All @@ -22,15 +24,14 @@ function embargoes_schema() {
'not null' => TRUE,
],
'action' => [
'type' => 'varchar',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qadan , I believe the reason why a string was used here was so that a username would persist even after the user is deleted from the Drupal instance.

'length' => 255,
'type' => 'int',
'not null' => TRUE,
],
'node' => [
'type' => 'int',
'not null' => TRUE,
],
'user' => [
'uid' => [
'type' => 'int',
'not null' => TRUE,
],
Expand All @@ -41,6 +42,32 @@ function embargoes_schema() {
],
],
'primary key' => ['id'],
'indexes' => [
'action' => ['action'],
'uid' => ['uid'],
'node' => ['node'],
],
];
return $schema;
}

/**
* Update the 'user' column to be called 'uid'.
*/
function embargoes_update_8001(&$sandbox) {
Database::getConnection()->schema()->changeField('embargoes_log', 'user', 'uid', [
'not null' => TRUE,
'type' => 'int',
]);
}

/**
* Add indices.
*/
function embargoes_update_8002(&$sandbox) {
$schema = Database::getConnection()->schema();
$embargoes_schema = embargoes_schema();
$schema->addIndex('embargoes_log', 'action', ['action'], $embargoes_schema['embargoes_log']);
$schema->addIndex('embargoes_log', 'uid', ['uid'], $embargoes_schema['embargoes_log']);
$schema->addIndex('embargoes_log', 'node', ['node'], $embargoes_schema['embargoes_log']);
}
7 changes: 0 additions & 7 deletions embargoes.libraries.yml

This file was deleted.

6 changes: 0 additions & 6 deletions embargoes.links.task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ entity.embargoes_embargo_entity.collection:
base_route: embargoes.settings
weight: 3

embargoes.settings.log:
route_name: embargoes.settings.log
title: 'Log'
base_route: embargoes.settings
weight: 4

embargoes.node.embargoes:
route_name: embargoes.node.embargoes
title: 'Embargoes'
Expand Down
Loading