Skip to content

Commit

Permalink
Fix permission issue for API fieldsets and fields endpoints (#7294)
Browse files Browse the repository at this point in the history
Close #7250
  • Loading branch information
mskrip authored and snipe committed Jul 24, 2019
1 parent af1857b commit 8a1f6b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/Api/CustomFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CustomFieldsController extends Controller

public function index()
{
$this->authorize('index', CustomFields::class);
$this->authorize('index', CustomField::class);
$fields = CustomField::get();
return (new CustomFieldsTransformer)->transformCustomFields($fields, $fields->count());
}
Expand All @@ -37,7 +37,7 @@ public function index()
*/
public function show($id)
{
$this->authorize('show', CustomField::class);
$this->authorize('view', CustomField::class);
if ($field = CustomField::find($id)) {
return (new CustomFieldsTransformer)->transformCustomField($field);
}
Expand All @@ -58,9 +58,9 @@ public function update(Request $request, $id)
{
$this->authorize('update', CustomField::class);
$field = CustomField::findOrFail($id);

/**
* Updated values for the field,
* Updated values for the field,
* without the "field_encrypted" flag, preventing the change of encryption status
* @var array
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/CustomFieldsetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function index()
*/
public function show($id)
{
$this->authorize('show', CustomFieldset::class);
$this->authorize('view', CustomFieldset::class);
if ($fieldset = CustomFieldset::find($id)) {
return (new CustomFieldsetsTransformer)->transformCustomFieldset($fieldset);
}
Expand Down

0 comments on commit 8a1f6b7

Please sign in to comment.