From 558286ade5fc1826bad8ab8a8d776dd39b8bac48 Mon Sep 17 00:00:00 2001 From: William Panting Date: Tue, 16 Oct 2012 13:25:04 -0300 Subject: [PATCH 1/2] ISLANDORA-761 fedora item setting ownerId as user->name rather than uid --- api/fedora_item.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 4a26e516..8a767c04 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1466,7 +1466,9 @@ RDF; * @param string $pid if none given, getnextpid will be called. * @param string $state The initial state, A - Active, I - Inactive, D - Deleted * @param type $label - * @param type $owner + * @param string $owner + * Used to set an object's ownerId attribute. Defaults to current user's + * name. * * @return DOMDocument */ @@ -1480,8 +1482,8 @@ RDF; if (empty($owner)) { global $user; // Default to current Drupal user. - if (!empty($user->uid)) { - $owner = $user->uid; + if (!empty($user->name)) { + $owner = $user->name; } // We are not inside Drupal. else { From 040395fe64e70453ef4fba7179f33e3827c65f00 Mon Sep 17 00:00:00 2001 From: William Panting Date: Tue, 16 Oct 2012 15:14:45 -0300 Subject: [PATCH 2/2] ISLANDORA-761 added in changes to improve how fedora item sets ownerId --- api/fedora_item.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 8a767c04..34a9acb5 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1468,7 +1468,7 @@ RDF; * @param type $label * @param string $owner * Used to set an object's ownerId attribute. Defaults to current user's - * name. + * name. If we are not a Drupal user(ie. Drush) defaults to ''. * * @return DOMDocument */ @@ -1485,9 +1485,9 @@ RDF; if (!empty($user->name)) { $owner = $user->name; } - // We are not inside Drupal. - else { - $owner = 'fedoraAdmin'; + // We are annonamous user. + elseif ($user->uid == 0) { + $owner = 'anonymous'; } }