Skip to content

Commit 3415d9b

Browse files
committed
Bug Fixes
1 parent 8dd74fd commit 3415d9b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/Darryldecode/Backend/Components/ContentBuilder/Commands/QueryContentTypeCommand.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,24 @@ public function handle(ContentType $contentType, Dispatcher $dispatcher)
4545
// check if has permission
4646
if( ! $this->disablePermissionChecking )
4747
{
48-
if( ! $this->user->hasAnyPermission(['contentBuilder.manage']) )
48+
// if $type->type is not provided, the request referrer should be from
49+
// the admin UI Content Type Builder component.
50+
// so we will check if the user has permission (contentBuilder.manage)
51+
// on the other hand,
52+
// if $type->type is provided, we will check if user has permission to manage that type
53+
if( ! is_null($this->type) && ($this->type!='') )
4954
{
50-
return new CommandResult(false, "Not enough permission.", null, 403);
55+
if( ! $this->user->hasAnyPermission([$this->type.'.manage']) )
56+
{
57+
return new CommandResult(false, "Not enough permission.", null, 403);
58+
}
59+
}
60+
else
61+
{
62+
if( ! $this->user->hasAnyPermission(['contentBuilder.manage']) )
63+
{
64+
return new CommandResult(false, "Not enough permission.", null, 403);
65+
}
5166
}
5267
}
5368

0 commit comments

Comments
 (0)