for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the Superdesk Web Publisher Core Bundle.
*
* Copyright 2016 Sourcefabric z.ú. and contributors.
* For the full copyright and license information, please see the
* AUTHORS and LICENSE files distributed with this source code.
* @copyright 2016 Sourcefabric z.ú
* @license http://www.superdesk.org/license
*/
namespace SWP\Bundle\CoreBundle\Model;
use SWP\Bundle\UserBundle\Model\User as BaseUser;
use SWP\Component\MultiTenancy\Model\OrganizationAwareTrait;
class User extends BaseUser implements UserInterface
{
use OrganizationAwareTrait;
public function setId(string $id): void
$this->id = $id;
}
/**
* {@inheritdoc}
public function addRole($role)
$role = strtoupper($role);
if ($role === static::ROLE_READER) {
return $this;
if (!in_array($role, $this->roles, true)) {
$this->roles[] = $role;
public function getRoles()
$roles = $this->roles;
foreach ($this->getGroups() as $group) {
$roles = array_merge($roles, $group->getRoles());
// we need to make sure to have at least one role
$roles[] = static::ROLE_READER;
return array_unique($roles);
public function getSubscriberId(): string
return $this->email;