If a user doesnt have permission to see an entries attributes - but can see the entry, disable edit and dont attempt to render. Further, if they cant see the objectclasses, dont make additional attributes available

This commit is contained in:
Deon George 2025-05-01 12:12:09 +09:30
parent b9ae269895
commit 5d23cbf0cc
3 changed files with 17 additions and 10 deletions

View File

@ -397,10 +397,10 @@ class HomeController extends Controller
->with('o',$o) ->with('o',$o)
->with('page_actions',collect([ ->with('page_actions',collect([
'copy'=>FALSE, 'copy'=>FALSE,
'create'=>TRUE, 'create'=>($x=($o->getObjects()->except('entryuuid')->count() > 0)),
'delete'=>TRUE, 'delete'=>$x,
'edit'=>TRUE, 'edit'=>$x,
'export'=>TRUE, 'export'=>$x,
])), ])),
'import' => $view, 'import' => $view,

View File

@ -274,7 +274,7 @@ class Entry extends Model
{ {
$result = collect(); $result = collect();
foreach ($this->getObject('objectclass')->values as $oc) foreach (($this->getObject('objectclass')?->values ?: []) as $oc)
$result = $result->merge(config('server')->schema('objectclasses',$oc)->attributes); $result = $result->merge(config('server')->schema('objectclasses',$oc)->attributes);
return $result; return $result;
@ -439,9 +439,10 @@ class Entry extends Model
*/ */
public function icon(): string public function icon(): string
{ {
$objectclasses = $this->getObject('objectclass') $objectclasses = ($x=$this->getObject('objectclass'))
->tagValues() ? $x->tagValues()
->map(fn($item)=>strtolower($item)); ->map(fn($item)=>strtolower($item))
: collect();
// Return icon based upon objectClass value // Return icon based upon objectClass value
if ($objectclasses->intersect([ if ($objectclasses->intersect([

View File

@ -88,8 +88,14 @@
<div class="card-header border-bottom-0"> <div class="card-header border-bottom-0">
<div class="btn-actions-pane-right"> <div class="btn-actions-pane-right">
<div role="group" class="btn-group-sm nav btn-group"> <div role="group" class="btn-group-sm nav btn-group">
@foreach($langtags->prepend(Entry::TAG_NOTAG)->push('+') as $tag) @php
<a data-bs-toggle="tab" href="#tab-lang-{{ $tag ?: '_default' }}" class="btn btn-outline-light border-dark-subtle @if(! $loop->index) active @endif @if($loop->last)ndisabled @endif"> $langtags->prepend(Entry::TAG_NOTAG);
if (isset($page_actions) && $page_actions->get('edit'))
$langtags->push('+');
@endphp
@foreach($langtags as $tag)
<a data-bs-toggle="tab" href="#tab-lang-{{ $tag ?: '_default' }}" @class(['btn','btn-outline-light','border-dark-subtle','active'=>!$loop->index])>
@switch($tag) @switch($tag)
@case(Entry::TAG_NOTAG) @case(Entry::TAG_NOTAG)
<i class="fas fa-fw fa-border-none" data-bs-toggle="tooltip" data-bs-custom-class="custom-tooltip" title="@lang('No Lang Tag')"></i> <i class="fas fa-fw fa-border-none" data-bs-toggle="tooltip" data-bs-custom-class="custom-tooltip" title="@lang('No Lang Tag')"></i>