mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-26 05:01:06 -08:00
Merge branch 'develop' of https://github.com/snipe/snipe-it into develop
This commit is contained in:
commit
da1c4c23e6
|
@ -68,7 +68,7 @@ class GroupsController extends Controller
|
|||
|
||||
$group->name = $request->input('name');
|
||||
$group->created_by = Auth::user()->id;
|
||||
$group->permissions = $request->input('permissions', $groupPermissions);
|
||||
$group->permissions = json_encode($request->input('permissions', $groupPermissions));
|
||||
|
||||
if ($group->save()) {
|
||||
return response()->json(Helper::formatStandardApiResponse('success', (new GroupsTransformer)->transformGroup($group), trans('admin/groups/message.success.create')));
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Feature\Api\Groups;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Group;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
@ -49,10 +50,15 @@ class GroupStoreTest extends TestCase
|
|||
|
||||
$this->assertNotNull($group);
|
||||
|
||||
$this->assertEquals(
|
||||
Helper::selectedPermissionsArray(config('permissions'), config('permissions')),
|
||||
$group->decodePermissions(),
|
||||
'Default group permissions were not set as expected',
|
||||
);
|
||||
|
||||
$this->actingAsForApi($superuser)
|
||||
->getJson(route('api.groups.show', ['group' => $group]))
|
||||
->assertOk();
|
||||
|
||||
}
|
||||
|
||||
public function testStoringGroupWithInvalidPermissionDropsBadPermission()
|
||||
|
|
Loading…
Reference in a new issue