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

Embargoes logs #9

Merged
merged 13 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
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
24 changes: 22 additions & 2 deletions embargoes.install
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function embargoes_schema() {
'not null' => TRUE,
],
'action' => [
'type' => 'varchar',
'length' => 255,
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
],
'node' => [
Expand All @@ -43,6 +43,11 @@ function embargoes_schema() {
],
],
'primary key' => ['id'],
'indexes' => [
'action' => ['action'],
'uid' => ['uid'],
'node' => ['node'],
],
];
return $schema;
}
Expand All @@ -56,3 +61,18 @@ function embargoes_update_8001(&$sandbox) {
'type' => 'int',
]);
}

/**
* Update the 'action' column to use integers. Add indices.
*/
function embargoes_update_8002(&$sandbox) {
$schema = Database::getConnection()->schema();
$schema->changeField('embargoes_log', 'action', 'action', [
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
]);
$schema->addIndex('embargoes_log', 'action', ['action']);
$schema->addIndex('embargoes_log', 'uid', ['uid']);
$schema->addIndex('embargoes_log', 'node', ['node']);
}
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