Skip to content

A free open source IT asset/license management system

Fixed #18422 - Hide edit buttons if the manager is looking at a different profile

snipe6d0bfeb4208d
diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php
index 9a80e1a64e..194a0864ca 100644
--- a/resources/lang/en-US/general.php
+++ b/resources/lang/en-US/general.php
@@ -242,7 +242,7 @@ return [
'previous' => 'Previous',
'previous_page' => 'Previous Page',
'processing' => 'Processing',
- 'profile' => 'Your Profile',
+ 'profile' => 'View Profile',
'purchase_cost' => 'Purchase Cost',
'purchase_date' => 'Purchase Date',
'qty' => 'QTY',
diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php
index 440091ff21..579c19afbf 100755
--- a/resources/views/account/view-assets.blade.php
+++ b/resources/views/account/view-assets.blade.php
@@ -2,28 +2,30 @@
{{-- Page title --}}
@section('title')
-{{ trans('general.hello_name', array('name' => $user->display_name)) }}
+{{ trans('general.hello_name', array('name' => auth()->user()->display_name)) }}
@parent
@stop
{{-- Account page content --}}
@section('content')
-@if ($acceptanceQuantity = \App\Models\CheckoutAcceptance::forUser(Auth::user())->pending()->sum('qty'))
- <div class="row">
- <div class="col-md-12">
- <div class="alert alert alert-warning fade in">
- <i class="fas fa-exclamation-triangle faa-pulse animated"></i>
-
- <strong>
- <a href="{{ route('account.accept') }}" style="color: white;">
- {{ trans_choice('general.unaccepted_profile_warning', $acceptanceQuantity, ['count' => $acceptanceQuantity]) }}
- </a>
- </strong>
- </div>
- </div>
- </div>
-@endif
+ @if (!request()->filled('user_id') || auth()->user()->id == $user->id)
+ @if ($acceptanceQuantity = \App\Models\CheckoutAcceptance::forUser(Auth::user())->pending()->sum('qty'))
+ <div class="row">
+ <div class="col-md-12">
+ <div class="alert alert alert-warning fade in">
+ <i class="fas fa-exclamation-triangle faa-pulse animated"></i>
+
+ <strong>
+ <a href="{{ route('account.accept') }}" style="color: white;">
+ {{ trans_choice('general.unaccepted_profile_warning', $acceptanceQuantity, ['count' => $acceptanceQuantity]) }}
+ </a>
+ </strong>
+ </div>
+ </div>
+ </div>
+ @endif
+ @endif
{{-- Manager View Dropdown --}}
@if (isset($settings) && $settings->manager_view_enabled && isset($subordinates) && $subordinates->count() > 1)
@@ -135,23 +137,25 @@
<div class="col-md-12 text-center">
<img src="{{ $user->present()->gravatar() }}" class=" img-thumbnail hidden-print" style="margin-bottom: 20px;" alt="{{ $user->display_name }}" alt="User avatar">
</div>
- <div class="col-md-12">
- <a href="{{ route('profile') }}" style="width: 100%;" class="btn btn-sm btn-warning btn-social btn-block hidden-print">
- <x-icon type="edit" />
- {{ trans('general.editprofile') }}
- </a>
- </div>
-
- @can('self.profile')
- @if (Auth::user()->ldap_import!='1')
- <div class="col-md-12" style="padding-top: 5px;">
- <a href="{{ route('account.password.index') }}" style="width: 100%;" class="btn btn-sm btn-theme btn-social btn-block hidden-print" rel="noopener">
- <x-icon type="password" class="fa-fw" />
- {{ trans('general.changepassword') }}
- </a>
- </div>
- @endif
+ @if (!request()->filled('user_id') || auth()->user()->id == $user->id)
+ <div class="col-md-12">
+ <a href="{{ route('profile') }}" style="width: 100%;" class="btn btn-sm btn-warning btn-social btn-block hidden-print">
+ <x-icon type="edit" />
+ {{ trans('general.editprofile') }}
+ </a>
+ </div>
+
+
+ @can('self.profile')
+ @if (Auth::user()->ldap_import!='1')
+ <div class="col-md-12" style="padding-top: 5px;">
+ <a href="{{ route('account.password.index') }}" style="width: 100%;" class="btn btn-sm btn-theme btn-social btn-block hidden-print" rel="noopener">
+ <x-icon type="password" class="fa-fw" />
+ {{ trans('general.changepassword') }}
+ </a>
+ </div>
+ @endif
@endcan
@can('self.api')
@@ -162,7 +166,7 @@
</a>
</div>
@endcan
-
+ @endif
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('profile.print') }}" style="width: 100%;" class="btn btn-sm btn-theme btn-social btn-block hidden-print" target="_blank" rel="noopener">