Small fix or groups API
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
e2a1be9762
commit
70854b2c42
2 changed files with 4 additions and 1 deletions
|
@ -76,7 +76,7 @@ class GroupsController extends Controller
|
||||||
$this->authorize('superadmin');
|
$this->authorize('superadmin');
|
||||||
$group = new Group;
|
$group = new Group;
|
||||||
// Get all the available permissions
|
// Get all the available permissions
|
||||||
$permissions = config('permissions');
|
$permissions = json_encode(config('permissions'));
|
||||||
$groupPermissions = Helper::selectedPermissionsArray($permissions, $permissions);
|
$groupPermissions = Helper::selectedPermissionsArray($permissions, $permissions);
|
||||||
|
|
||||||
$group->name = $request->input('name');
|
$group->name = $request->input('name');
|
||||||
|
|
|
@ -81,6 +81,9 @@ class Group extends SnipeModel
|
||||||
public function decodePermissions()
|
public function decodePermissions()
|
||||||
{
|
{
|
||||||
// Set default to empty JSON if the value is null
|
// Set default to empty JSON if the value is null
|
||||||
|
if (is_array($this->permissions)) {
|
||||||
|
$this->permissions = json_encode($this->permissions);
|
||||||
|
}
|
||||||
$permissions = json_decode($this->permissions ?? '{}', JSON_OBJECT_AS_ARRAY);
|
$permissions = json_decode($this->permissions ?? '{}', JSON_OBJECT_AS_ARRAY);
|
||||||
|
|
||||||
// If there are no permissions, return an empty array
|
// If there are no permissions, return an empty array
|
||||||
|
|
Loading…
Add table
Reference in a new issue