Push basis of new API key policy

Will need to revisit this another day when I’m fresh to figure out the
best method to do this.
This commit is contained in:
Dane Everitt
2017-04-07 21:25:17 -04:00
parent 51204b8d9d
commit db4df2bfa1
6 changed files with 104 additions and 19 deletions

View File

@@ -60,9 +60,17 @@ class ServerController extends Controller
public function view(Request $request, $id)
{
$server = Server::findOrFail($id);
$fractal = Fractal::create()->item($server);
// dd($request->user()->can('view-node', $request->apiKey()));
// Have the api key model return a list of includes that would be allowed
// given the permissions they have aleady been granted?
//
// If someone has 'view-node' they would then be able to use ->parseIncludes(['*.node.*']);
// How that logic will work is beyond me currently, but should keep things
// fairly clean?
if ($request->input('include')) {
$fractal->parseIncludes(explode(',', $request->input('include')));
}