Skip to content
Snippets Groups Projects
Commit f408beef authored by Alex Vandiver's avatar Alex Vandiver
Browse files

We don't care about the list of objects, only if it is empty or not

parent e0fc7782
No related branches found
No related tags found
No related merge requests found
......@@ -404,6 +404,28 @@ sub ObjectsForLoading {
return @objects;
}
sub CurrentUserCanCreateAny {
my $self = shift;
my @objects;
my $CurrentUser = $self->CurrentUser;
return 1
if $CurrentUser->HasRight(Object => $RT::System, Right => 'CreateOwnDashboard');
my $groups = RT::Groups->new($CurrentUser);
$groups->LimitToUserDefinedGroups;
$groups->ForWhichCurrentUserHasRight(
Right => 'CreateGroupDashboard',
IncludeSuperusers => 1,
);
return 1 if $groups->Count;
return 1
if $CurrentUser->HasRight(Object => $RT::System, Right => 'CreateDashboard');
return 0;
}
RT::Base->_ImportOverlays();
1;
......@@ -90,7 +90,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
$dashes->child( select => title => loc('Select'), path => "/Dashboards/index.html" );
my $dashboard = RT::Dashboard->new( $session{CurrentUser} );
if ( $dashboard->ObjectsForCreating ) {
if ( $dashboard->CurrentUserCanCreateAny ) {
$dashes->child( loc('Create') => path => "/Dashboards/Modify.html?Create=1" );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment