Skip to content

Commit

Permalink
Merge pull request #9 from qadan/embargoes-logs
Browse files Browse the repository at this point in the history
Embargoes logs
  • Loading branch information
JojoVes authored Aug 5, 2020
2 parents 4569395 + ad63c0a commit 1ff0ba0
Show file tree
Hide file tree
Showing 34 changed files with 1,580 additions and 205 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Embargoes

# Introduction

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

## Requirements
Expand Down Expand Up @@ -34,11 +32,6 @@ 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.

### Logging

Embargo logs are kept at `admin/config/content/embargoes/settings/log`,
including who created the embargo, or how it was changed.

## Troubleshooting/Issues

Having problems or solved one? Contact
Expand Down
2 changes: 1 addition & 1 deletion config/schema/embargoes.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ embargoes.embargoes_embargo_entity.*:
type: integer
label: 'Embargoed Node'
notification_status:
type: string
type: integer
label: 'Notification Status'

embargoes.embargoes_ip_range_entity.*:
Expand Down
19 changes: 17 additions & 2 deletions embargoes.install
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function embargoes_schema() {
'not null' => TRUE,
],
'action' => [
'type' => 'varchar',
'length' => 255,
'type' => 'int',
'not null' => TRUE,
],
'node' => [
Expand All @@ -43,6 +42,11 @@ function embargoes_schema() {
],
],
'primary key' => ['id'],
'indexes' => [
'action' => ['action'],
'uid' => ['uid'],
'node' => ['node'],
],
];
return $schema;
}
Expand All @@ -56,3 +60,14 @@ function embargoes_update_8001(&$sandbox) {
'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']);
}
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
14 changes: 13 additions & 1 deletion embargoes.module
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,21 @@ function embargoes_theme($existing, $type, $theme, $path) {
'requested_resource' => NULL,
// Indexed array of ranges containing a 'proxy URL' (NULL if none exist)
// and a display 'label'.
'ranges' => [],
'ranges' => [
[
'label' => NULL,
'proxy_url' => NULL,
],
],
'contact_email' => NULL,
],
],
'embargoes_policies' => [
'template' => 'embargoes-policies',
'variables' => [
'count' => NULL,
'embargo_info' => [],
],
],
];
}
10 changes: 7 additions & 3 deletions embargoes.permissions.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
administer embargoes settings:
title: 'Administer Embargoes settings'
description: 'Access and manage configuration for the Embargoes module'
restrict access: TRUE
restrict access: true
manage embargoes:
title: 'Manage Embargoes'
description: 'Apply, update and lift embargo policies on content'
restrict access: TRUE
restrict access: true
bypass embargoes restrictions:
title: 'Bypass Embargoes restrictions'
description: 'Bypass access restrictions on content put in place by embargo policies'
restrict access: TRUE
restrict access: true
access embargoes logs:
title: 'Access embargoes logs'
description: 'View logs from the creation, updating, and deleting of embargoes'
restrict access: true
8 changes: 0 additions & 8 deletions embargoes.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ embargoes.settings.notifications:
requirements:
_permission: 'administer embargoes settings'

embargoes.settings.log:
path: '/admin/config/content/embargoes/settings/log'
defaults:
_controller: '\Drupal\embargoes\Controller\EmbargoesLogController::showRenderedLog'
_title: 'Embargo Activity Log'
requirements:
_permission: 'administer embargoes settings'

embargoes.node.embargoes:
path: '/node/{node}/embargoes'
defaults:
Expand Down
6 changes: 5 additions & 1 deletion embargoes.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ services:
arguments: ['@database']
embargoes.embargoes:
class: Drupal\embargoes\EmbargoesEmbargoesService
arguments: ['@entity_type.manager', '@entity_field.manager', '@embargoes.ips']
arguments:
- '@entity_type.manager'
- '@entity_field.manager'
- '@embargoes.ips'
- '@string_translation'
embargoes.ips:
class: Drupal\embargoes\EmbargoesIpRangesService
arguments: ['@entity_type.manager']
Expand Down
Loading

0 comments on commit 1ff0ba0

Please sign in to comment.