From 7038895cc4ed58d55090458cb1b8974307f2b074 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 26 May 2017 18:38:06 -0300 Subject: [PATCH] Update hook grants permission to whoever can currently view objects. --- islandora.install | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/islandora.install b/islandora.install index 95cca708..cfb843ab 100644 --- a/islandora.install +++ b/islandora.install @@ -132,3 +132,18 @@ function islandora_update_7001(&$sandbox) { $t = get_t(); return $t("Islandora database updates complete"); } + +/** + * Implements hook_update_N(). + * + * Add default permissions for viewing inactive or deleted objects. + * Match permissions for viewing all objects. + */ +function islandora_update_7002(&$sandbox) { + $roles = user_roles(FALSE, ISLANDORA_VIEW_OBJECTS); + foreach ($roles as $rid => $role) { + user_role_grant_permissions($rid, array(ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS)); + } + $t = get_t(); + return $t("Islandora permission updates complete. Please manage permissions to assign the new permission, 'view inactive or deleted objects', to appropriate roles."); +}