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
ae74cc2f
Commit
ae74cc2f
authored
Nov 26, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Plain Diff
Fix merge conflict
parents
46b2698a
f4edb764
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
User.php
Modules/User/Entities/Sentinel/User.php
+7
-1
User.php
Modules/User/Entities/Sentry/User.php
+11
-1
UserInterface.php
Modules/User/Entities/UserInterface.php
+11
-0
edit.blade.php
Modules/User/Resources/views/admin/users/edit.blade.php
+1
-1
No files found.
Modules/User/Entities/Sentinel/User.php
View file @
ae74cc2f
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
use
Cartalyst\Sentinel\Users\EloquentUser
;
use
Cartalyst\Sentinel\Users\EloquentUser
;
use
Laracasts\Presenter\PresentableTrait
;
use
Laracasts\Presenter\PresentableTrait
;
use
Modules\User\Entities\UserInterface
;
class
User
extends
EloquentUser
class
User
extends
EloquentUser
implements
UserInterface
{
{
use
PresentableTrait
;
use
PresentableTrait
;
...
@@ -16,4 +17,9 @@ class User extends EloquentUser
...
@@ -16,4 +17,9 @@ class User extends EloquentUser
];
];
protected
$presenter
=
'Modules\User\Presenters\UserPresenter'
;
protected
$presenter
=
'Modules\User\Presenters\UserPresenter'
;
public
function
hasRole
(
$roleId
)
{
return
$this
->
roles
()
->
whereId
(
$roleId
)
->
count
()
>=
1
;
}
}
}
Modules/User/Entities/Sentry/User.php
View file @
ae74cc2f
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
use
Cartalyst\Sentry\Users\Eloquent\User
as
SentryModel
;
use
Cartalyst\Sentry\Users\Eloquent\User
as
SentryModel
;
use
Laracasts\Presenter\PresentableTrait
;
use
Laracasts\Presenter\PresentableTrait
;
use
Modules\User\Entities\UserInterface
;
class
User
extends
SentryModel
class
User
extends
SentryModel
implements
UserInterface
{
{
use
PresentableTrait
;
use
PresentableTrait
;
...
@@ -21,4 +22,13 @@ class User extends SentryModel
...
@@ -21,4 +22,13 @@ class User extends SentryModel
{
{
return
$this
->
belongsToMany
(
static
::
$groupModel
,
static
::
$userGroupsPivot
,
'user_id'
);
return
$this
->
belongsToMany
(
static
::
$groupModel
,
static
::
$userGroupsPivot
,
'user_id'
);
}
}
/**
* Checks if a user belongs to the given Role ID
* @param int $roleId
* @return bool
*/
public
function
hasRole
(
$roleId
)
{
}
}
}
Modules/User/Entities/UserInterface.php
0 → 100644
View file @
ae74cc2f
<?php
namespace
Modules\User\Entities
;
interface
UserInterface
{
/**
* Checks if a user belongs to the given Role ID
* @param int $roleId
* @return bool
*/
public
function
hasRole
(
$roleId
);
}
Modules/User/Resources/views/admin/users/edit.blade.php
View file @
ae74cc2f
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
<label>{{ trans('user::users.tabs.roles') }}</label>
<label>{{ trans('user::users.tabs.roles') }}</label>
<select multiple="" class="
form
-
control
" name="
roles
[]
">
<select multiple="" class="
form
-
control
" name="
roles
[]
">
<?php foreach(
$roles
as
$role
): ?>
<?php foreach(
$roles
as
$role
): ?>
<option value="
{{
$role
->
id
}}
" <?php echo
$user->
roles
()->whereId(
$role->id
)->count() >= 1
? 'selected' : '' ?>>{{
$role->name
}}</option>
<option value="
{{
$role
->
id
}}
" <?php echo
$user->
hasRole
(
$role->id
)
? 'selected' : '' ?>>{{
$role->name
}}</option>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
</select>
</div>
</div>
...
...
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