Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #205 from jonasdekeukelaere/user-inheritance
Browse files Browse the repository at this point in the history
User inheritance
  • Loading branch information
StijnVrolijk authored Oct 25, 2017
2 parents 4a2271d + cfae7d2 commit f643c6a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,9 @@ jms_translation:
excluded_names: ["*TestCase.php", "*Test.php", "DefaultMenuListener.php"]
excluded_dirs: [cache, data, logs]
extractors: [jms_i18n_routing]

sumo_coders_framework_multi_user:
redirect_routes:
SumoCoders\FrameworkUserBundle\Entity\Admin: sumocoders_frameworkuser_index_index
# todo when you add a page accessable by user, will default to "/"
# SumoCoders\FrameworkUserBundle\Entity\User:
15 changes: 13 additions & 2 deletions src/SumoCoders/FrameworkUserBundle/Entity/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@

use Doctrine\ORM\Mapping as ORM;
use SumoCoders\FrameworkMultiUserBundle\Entity\BaseUser;
use SumoCoders\FrameworkMultiUserBundle\Security\PasswordResetToken;

/**
* @ORM\Entity(repositoryClass="SumoCoders\FrameworkUserBundle\Repository\AdminRepository")
* @ORM\Table()
*/
final class Admin extends User
final class Admin extends BaseUser
{
public function __construct(
string $plainPassword,
string $displayName,
string $email,
int $id = null,
PasswordResetToken $token = null
) {
parent::__construct($email, $plainPassword, $displayName, $email, $id, $token);
}

public function getRoles(): array
{
return ['ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'];
return ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'];
}

public function canSwitchTo(BaseUser $user): bool
Expand Down

0 comments on commit f643c6a

Please sign in to comment.