@@ -22,7 +22,7 @@
|
||||
{% for entry in entries %}
|
||||
<tr>
|
||||
<td class="hidden-xs">{{ entry.id }}</td>
|
||||
<td>{{ entry.alias|default(entry.username) }}</td>
|
||||
<td>{{ widgets.username(entry) }}</td>
|
||||
<td class="hidden-xs">{{ entry.username }}</td>
|
||||
<td class="hidden-xs hidden-sm">{{ entry.email }}</td>
|
||||
<td class="hidden-xs">{{ entry.title }}</td>
|
||||
|
||||
@@ -149,11 +149,12 @@
|
||||
|
||||
{% macro profile_box(user, stats) %}
|
||||
{% import "AvanzuAdminThemeBundle:layout:macros.html.twig" as macro %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-body box-profile">
|
||||
{{ macro.avatar(user.avatar, user.username, 'profile-user-img img-responsive img-circle') }}
|
||||
<h3 class="profile-username text-center">{{ user.alias|default(user.username) }}</h3>
|
||||
<h3 class="profile-username text-center">{{ widgets.username(user) }}</h3>
|
||||
|
||||
<p class="text-muted text-center">{{ user.title }}</p>
|
||||
|
||||
@@ -186,6 +187,8 @@
|
||||
{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
|
||||
{% macro profile_list_unused(user, items, color) %}
|
||||
{% import "AvanzuAdminThemeBundle:layout:macros.html.twig" as macro %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
<div class="box box-widget widget-user-2">
|
||||
<!-- Add the bg color to the header using any of the bg-* classes -->
|
||||
<div class="widget-user-header bg-{{ color|default(kimai_context.box_color) }}">
|
||||
@@ -193,7 +196,7 @@
|
||||
{{ macro.avatar(user.avatar, user.username) }}
|
||||
</div>
|
||||
<!-- /.widget-user-image -->
|
||||
<h3 class="widget-user-username">{{ user.alias|default(user.username) }}</h3>
|
||||
<h3 class="widget-user-username">{{ widgets.username(user) }}</h3>
|
||||
<h5 class="widget-user-desc">{{ user.title }}</h5>
|
||||
</div>
|
||||
<div class="box-footer no-padding">
|
||||
@@ -209,10 +212,11 @@
|
||||
{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
|
||||
{% macro profile_box_unused(user, stats, color) %}
|
||||
{% import "AvanzuAdminThemeBundle:layout:macros.html.twig" as macro %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
<div class="box box-widget widget-user">
|
||||
<div class="widget-user-header bg-{{ color|default(kimai_context.box_color) }}">
|
||||
<h3 class="widget-user-username">{{ user.alias|default(user.username) }}</h3>
|
||||
<h3 class="widget-user-username">{{ widgets.username(user) }}</h3>
|
||||
<h5 class="widget-user-desc">{{ user.title }}</h5>
|
||||
</div>
|
||||
<div class="widget-user-image">
|
||||
|
||||
@@ -43,53 +43,77 @@ class LoadFixtures implements FixtureInterface, ContainerAwareInterface
|
||||
$passwordEncoder = $this->container->get('security.password_encoder');
|
||||
|
||||
$claraCustomer = new User();
|
||||
$claraCustomer->setAlias('Clara Haynes');
|
||||
$claraCustomer->setTitle('CFO');
|
||||
$claraCustomer->setUsername('clara_customer');
|
||||
$claraCustomer->setEmail('clara_customer@example.com');
|
||||
$claraCustomer->setRoles(['ROLE_CUSTOMER']);
|
||||
$claraCustomer->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=monsterid&f=y');
|
||||
$claraCustomer->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
|
||||
$claraCustomer
|
||||
->setAlias('Clara Haynes')
|
||||
->setTitle('CFO')
|
||||
->setUsername('clara_customer')
|
||||
->setEmail('clara_customer@example.com')
|
||||
->setRoles(['ROLE_CUSTOMER'])
|
||||
->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=monsterid&f=y')
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
;
|
||||
$manager->persist($claraCustomer);
|
||||
|
||||
$johnUser = new User();
|
||||
$johnUser->setAlias('John Doe');
|
||||
$johnUser->setTitle('Developer');
|
||||
$johnUser->setUsername('john_user');
|
||||
$johnUser->setEmail('john_user@example.com');
|
||||
$johnUser->setRoles(['ROLE_USER']);
|
||||
$johnUser->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro&f=y');
|
||||
$johnUser->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
|
||||
$johnUser
|
||||
->setAlias('John Doe')
|
||||
->setTitle('Developer')
|
||||
->setUsername('john_user')
|
||||
->setEmail('john_user@example.com')
|
||||
->setRoles(['ROLE_USER'])
|
||||
->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro&f=y')
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
;
|
||||
$manager->persist($johnUser);
|
||||
|
||||
$deactiveUser = new User();
|
||||
$deactiveUser
|
||||
->setAlias('Chris Deactive')
|
||||
->setTitle('Developer (left company)')
|
||||
->setUsername('chris_user')
|
||||
->setEmail('chris_user@example.com')
|
||||
->setRoles(['ROLE_USER'])
|
||||
->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro&f=y')
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
// inactive for testing user login and UI
|
||||
->setActive(false)
|
||||
;
|
||||
$manager->persist($deactiveUser);
|
||||
|
||||
$tonyTeamlead = new User();
|
||||
$tonyTeamlead->setAlias('Tony Maier');
|
||||
$tonyTeamlead->setTitle('Head of Development');
|
||||
$tonyTeamlead->setUsername('tony_teamlead');
|
||||
$tonyTeamlead->setEmail('tony_teamlead@example.com');
|
||||
$tonyTeamlead->setRoles(['ROLE_TEAMLEAD']);
|
||||
$tonyTeamlead->setAvatar('https://en.gravatar.com/userimage/3533186/bf2163b1dd23f3107a028af0195624e9.jpeg');
|
||||
$tonyTeamlead->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
|
||||
$tonyTeamlead
|
||||
->setAlias('Tony Maier')
|
||||
->setTitle('Head of Development')
|
||||
->setUsername('tony_teamlead')
|
||||
->setEmail('tony_teamlead@example.com')
|
||||
->setRoles(['ROLE_TEAMLEAD'])
|
||||
->setAvatar('https://en.gravatar.com/userimage/3533186/bf2163b1dd23f3107a028af0195624e9.jpeg')
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
;
|
||||
$manager->persist($tonyTeamlead);
|
||||
|
||||
$annaAdmin = new User();
|
||||
$annaAdmin->setAlias('Anna Smith');
|
||||
$annaAdmin->setTitle('Administrator');
|
||||
$annaAdmin->setUsername('anna_admin');
|
||||
$annaAdmin->setEmail('anna_admin@example.com');
|
||||
$annaAdmin->setRoles(['ROLE_ADMIN']);
|
||||
// no avatar to test default image!
|
||||
$annaAdmin->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
|
||||
$annaAdmin
|
||||
->setAlias('Anna Smith')
|
||||
->setTitle('Administrator')
|
||||
->setUsername('anna_admin')
|
||||
->setEmail('anna_admin@example.com')
|
||||
->setRoles(['ROLE_ADMIN'])
|
||||
// no avatar to test default image!
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
;
|
||||
$manager->persist($annaAdmin);
|
||||
|
||||
$susanSuper = new User();
|
||||
$susanSuper->setAlias('Susan Sanchez');
|
||||
$susanSuper->setTitle('Super Administrator');
|
||||
$susanSuper->setUsername('susan_super');
|
||||
$susanSuper->setEmail('susan_super@example.com');
|
||||
$susanSuper->setRoles(['ROLE_SUPER_ADMIN']);
|
||||
$susanSuper->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=wavatar&f=y');
|
||||
$susanSuper->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
|
||||
$susanSuper
|
||||
// no alias to test the username macros
|
||||
->setTitle('Super Administrator')
|
||||
->setUsername('susan_super')
|
||||
->setEmail('susan_super@example.com')
|
||||
->setRoles(['ROLE_SUPER_ADMIN'])
|
||||
->setAvatar('/bundles/avanzuadmintheme/img/avatar.png')
|
||||
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
|
||||
;
|
||||
$manager->persist($susanSuper);
|
||||
|
||||
$manager->flush();
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace AppBundle\Entity;
|
||||
|
||||
use AppBundle\Validator\Constraints as KimaiAssert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
@@ -24,7 +25,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
*
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class User implements UserInterface
|
||||
class User implements UserInterface, AdvancedUserInterface
|
||||
{
|
||||
|
||||
const DEFAULT_ROLE = 'ROLE_USER';
|
||||
@@ -193,11 +194,20 @@ class User implements UserInterface
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActive()
|
||||
public function isActive()
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActive()
|
||||
{
|
||||
return $this->isActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
* @return $this
|
||||
@@ -359,6 +369,38 @@ class User implements UserInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isAccountNonExpired()
|
||||
{
|
||||
return $this->isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
return $this->isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
return $this->isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->isActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the salt that was originally used to encode the password.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user