Revision 4905
Added by walbridge over 15 years ago
src/perl/register-dataset.cgi | ||
---|---|---|
2568 | 2568 |
|
2569 | 2569 |
$results = $doc->findnodes('/eml:eml/access/allow'); |
2570 | 2570 |
my $accessError = 0; |
2571 |
my $docOwner; |
|
2571 | 2572 |
|
2572 | 2573 |
foreach $node ($results->get_nodelist) { |
2573 | 2574 |
my @children = $node->childNodes; |
... | ... | |
2582 | 2583 |
} |
2583 | 2584 |
} |
2584 | 2585 |
# if the principal is any one of the moderators, the script will handle it |
2585 |
my @admins = $moderators; |
|
2586 |
my @admins; |
|
2587 |
foreach (split(":", $moderators)) { |
|
2588 |
push(@admins, $_); |
|
2589 |
} |
|
2586 | 2590 |
push(@admins, $adminUsername); |
2587 | 2591 |
|
2588 | 2592 |
if ($principal eq 'public' && $permission ne 'read') { $accessError = 1; } |
2589 | 2593 |
if ($principal eq $adminUsername && $permission ne 'all') { $accessError = 2; } |
2590 |
if ($principal ne 'public' && !grep {$_ eq $principal} @admins && $permission ne 'all') { $accessError = 3; } |
|
2594 |
if ($principal ne 'public' && !grep {$_ eq $principal} @admins && $permission ne 'all') { |
|
2595 |
$accessError = 3; |
|
2596 |
$docOwner = $principal; |
|
2597 |
} |
|
2591 | 2598 |
# TODO: FIXME for 1.9.1 |
2592 | 2599 |
# The ESA skin has a separate concept of 'moderator', which is defined by a property |
2593 | 2600 |
# within the configuration. This should be updated to check the user against the groups. |
... | ... | |
2612 | 2619 |
} |
2613 | 2620 |
|
2614 | 2621 |
if ($accessError != 0) { |
2615 |
my $error = "The ACL for this document has been changed outside the registry. Please use Morpho to edit this document (Access Error #$accessError)."; |
|
2616 |
push(@errorMessages, $error."\n"); |
|
2622 |
my $error; |
|
2623 |
if ($accessError == 3) { |
|
2624 |
$error = "You don't have permission to edit this document, which is owned by $docOwner. (Access Error #3)\n"; |
|
2625 |
} else { |
|
2626 |
my $error = "The ACL for this document has been changed outside the registry. Please use Morpho to edit this document (Access Error #$accessError).\n"; |
|
2627 |
} |
|
2628 |
push(@errorMessages, $error); |
|
2617 | 2629 |
} |
2618 | 2630 |
|
2619 | 2631 |
# handle otherEntity objects, by populating the relevant file form elements |
... | ... | |
3486 | 3498 |
if ($response != '1') { |
3487 | 3499 |
return " Unable to set access for the review document in Metacat for the docid:".$docid; |
3488 | 3500 |
} |
3489 |
foreach (split(":",$moderators)) { |
|
3501 |
foreach (split(":", $moderators)) {
|
|
3490 | 3502 |
$response = $metacat->setaccess($reviewDocumentId, $_, "all", "allow", "denyFirst"); |
3491 | 3503 |
if ($response != '1') { |
3492 | 3504 |
return " Unable to set access for the review document in Metacat for the docid:".$docid; |
Also available in: Unified diff
Display helpful error message when user lacks permissions to edit a document, supress the 'use Morpho' message (closes Bug #3928)