Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
d6b2f12f
Commit
d6b2f12f
authored
Sep 27, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding permissions to the workshop module
parent
5159dfe0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
6 deletions
+65
-6
SidebarViewComposer.php
Composers/SidebarViewComposer.php
+3
-3
permissions.php
Config/permissions.php
+13
-0
ModulesController.php
Http/Controllers/ModulesController.php
+2
-0
WorkbenchController.php
Http/Controllers/WorkbenchController.php
+6
-0
PermissionFilter.php
Http/Filters/PermissionFilter.php
+10
-0
routes.php
Http/routes.php
+1
-1
WorkshopServiceProvider.php
Providers/WorkshopServiceProvider.php
+30
-2
No files found.
Composers/SidebarViewComposer.php
View file @
d6b2f12f
...
...
@@ -10,19 +10,19 @@ class SidebarViewComposer
$view
->
items
->
put
(
'workbench'
,
Collection
::
make
([
[
'weight'
=>
'1'
,
'request'
=>
Request
::
is
(
"
{
$view
->
prefix
}
/
workshop
*"
),
'request'
=>
Request
::
is
(
"
{
$view
->
prefix
}
/
modules*"
)
or
Request
::
is
(
"
{
$view
->
prefix
}
/workbench
*"
),
'route'
=>
'#'
,
'icon-class'
=>
'fa fa-cogs'
,
'title'
=>
'Workshop'
,
],
[
'request'
=>
"
{
$view
->
prefix
}
/
workshop/
modules*"
,
'request'
=>
"
{
$view
->
prefix
}
/modules*"
,
'route'
=>
'dashboard.modules.index'
,
'icon-class'
=>
'fa fa-cog'
,
'title'
=>
'Modules'
,
],
[
'request'
=>
"
{
$view
->
prefix
}
/work
shop/work
bench*"
,
'request'
=>
"
{
$view
->
prefix
}
/workbench*"
,
'route'
=>
'dashboard.workbench.index'
,
'icon-class'
=>
'fa fa-cog'
,
'title'
=>
'Workbench'
,
...
...
Config/permissions.php
0 → 100644
View file @
d6b2f12f
<?php
return
[
'modules'
=>
[
'index'
,
'store'
,
],
'workbench'
=>
[
'index'
,
'generate'
,
'migrate'
,
'install'
,
]
];
\ No newline at end of file
Http/Controllers/ModulesController.php
View file @
d6b2f12f
...
...
@@ -19,7 +19,9 @@ class ModulesController extends AdminBaseController
parent
::
__construct
();
$this
->
moduleManager
=
$moduleManager
;
$this
->
beforeFilter
(
'permissions'
);
}
public
function
index
()
{
$modules
=
$this
->
moduleManager
->
all
();
...
...
Http/Controllers/WorkbenchController.php
View file @
d6b2f12f
...
...
@@ -12,6 +12,12 @@ use Symfony\Component\Console\Output\BufferedOutput;
class
WorkbenchController
extends
AdminBaseController
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
beforeFilter
(
'permissions'
);
}
public
function
index
()
{
return
View
::
make
(
'workshop::admin.workbench.index'
);
...
...
Http/Filters/PermissionFilter.php
0 → 100644
View file @
d6b2f12f
<?php
namespace
Modules\Workshop\Http\Filters
;
class
PermissionFilter
{
public
function
filter
()
{
//
}
}
\ No newline at end of file
Http/routes.php
View file @
d6b2f12f
<?php
Route
::
group
([
'prefix'
=>
Config
::
get
(
'core::core.admin-prefix'
)
.
'/workshop'
,
'namespace'
=>
'Modules\Workshop\Http\Controllers'
],
Route
::
group
([
'prefix'
=>
Config
::
get
(
'core::core.admin-prefix'
),
'namespace'
=>
'Modules\Workshop\Http\Controllers'
],
function
()
{
Route
::
get
(
'modules'
,
[
'as'
=>
'dashboard.modules.index'
,
'uses'
=>
'ModulesController@index'
]);
Route
::
post
(
'modules'
,
[
'as'
=>
'dashboard.modules.store'
,
'uses'
=>
'ModulesController@store'
]);
...
...
Providers/WorkshopServiceProvider.php
View file @
d6b2f12f
<?php
namespace
Modules\Workshop\Providers
;
use
Illuminate\Routing\Router
;
use
Illuminate\Support\ServiceProvider
;
class
WorkshopServiceProvider
extends
ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
...
...
@@ -12,6 +12,30 @@ class WorkshopServiceProvider extends ServiceProvider
*/
protected
$defer
=
false
;
/**
* The filters base class name.
*
* @var array
*/
protected
$filters
=
[
'permissions'
=>
'PermissionFilter'
];
/**
* Register the filters.
*
* @param Router $router
* @return void
*/
public
function
registerFilters
(
Router
$router
)
{
foreach
(
$this
->
filters
as
$name
=>
$filter
)
{
$class
=
'Modules\\Workshop\\Http\\Filters\\'
.
$filter
;
$router
->
filter
(
$name
,
$class
);
}
}
/**
* Register the service provider.
*
...
...
@@ -19,7 +43,11 @@ class WorkshopServiceProvider extends ServiceProvider
*/
public
function
register
()
{
//
$this
->
app
->
booted
(
function
(
$app
)
{
$this
->
registerFilters
(
$app
[
'router'
]);
}
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment