[Rt-commit] r3737 - in rtfm/branches/2.1-TESTING: .
html/Admin/RTFM/Classes lib/RT/FM
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Aug 30 14:19:24 EDT 2005
Author: alexmv
Date: Tue Aug 30 14:19:23 2005
New Revision: 3737
Modified:
rtfm/branches/2.1-TESTING/ (props changed)
rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/index.html
rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm
Log:
r6163 at zoq-fot-pik: chmrr | 2005-08-30 14:18:38 -0400
* Make topic create pull permissions from the right place
* Make the admin classes index aware that AdminTopics rights are also sufficient
Modified: rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/index.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/index.html (original)
+++ rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/index.html Tue Aug 30 14:19:23 2005
@@ -28,9 +28,14 @@
<LI> <i><&|/l&>No Classes matching search criteria found.</&></i>
% }
% foreach my $class ( @allowed_classes ) {
+% if ($session{'CurrentUser'}->UserObj->HasRight(Right => 'AdminClass', Object => $class)) {
<LI><A HREF="Modify.html?id=<%$class->id%>"><%$class->Name%></a></LI>
+% } else {
+<LI><A HREF="Topics.html?id=<%$class->id%>"><%$class->Name%></a></LI>
+% }
%}
+
</UL>
</TD>
</TR>
@@ -63,7 +68,8 @@
}
# Limit to only those classes that the user may admin.
while (my $class = $Classes->Next()) {
- push(@allowed_classes, $class) if $session{'CurrentUser'}->UserObj->HasRight(Right => 'AdminClass', Object => $class);
+ push(@allowed_classes, $class) if $session{'CurrentUser'}->UserObj->HasRight(Right => 'AdminClass', Object => $class)
+ or $session{'CurrentUser'}->UserObj->HasRight(Right => 'AdminTopics', Object => $class);
}
</%INIT>
Modified: rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm
==============================================================================
--- rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm (original)
+++ rtfm/branches/2.1-TESTING/lib/RT/FM/Topic_Overlay.pm Tue Aug 30 14:19:23 2005
@@ -44,10 +44,25 @@
sub Create {
my $self = shift;
-
- unless ( $self->CurrentUserHasRight('AdminTopics') ) {
- return ( 0, $self->loc("Permission Denied") );
- }
+ my %args = (
+ Parent => '',
+ Name => '',
+ Description => '',
+ ObjectType => '',
+ ObjectId => '0',
+ @_);
+
+ my $obj = $RT::FM::System;
+ if ($args{ObjectId}) {
+ $obj = $args{ObjectType}->new($self->CurrentUser);
+ $obj->Load($args{ObjectId});
+ }
+
+ return ( 0, $self->loc("Permission denied"))
+ unless ( $self->CurrentUser->HasRight(
+ Right => "AdminTopics",
+ Object => $obj,
+ ) );
$self->SUPER::Create(@_);
}
@@ -140,9 +155,9 @@
sub Children {
my $self = shift;
unless ($self->{'Children'}) {
- $self->{'Children'} = RT::FM::TopicCollection->new($self->CurrentUser);
- $self->{'Children'}->Limit('FIELD' => 'Parent',
- 'VALUE' => $self->Id);
+ $self->{'Children'} = RT::FM::TopicCollection->new($self->CurrentUser);
+ $self->{'Children'}->Limit('FIELD' => 'Parent',
+ 'VALUE' => $self->Id);
}
return $self->{'Children'};
}
More information about the Rt-commit
mailing list