Skip to content

Commit

Permalink
Merge pull request #1084 from kitan1982/workspace-users
Browse files Browse the repository at this point in the history
Add a method to find user by username and mail
  • Loading branch information
ngodfraind committed Mar 27, 2015
2 parents 570c726 + 5729cb8 commit c98162d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Manager/UserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,15 @@ public function getUserByUsernameOrMail($username, $mail, $executeQuery = true)
);
}

public function getUserByUsernameAndMail($username, $mail, $executeQuery = true)
{
return $this->userRepo->findUserByUsernameAndMail(
$username,
$mail,
$executeQuery
);
}

public function getCountAllEnabledUsers($executeQuery = true)
{
return $this->userRepo->countAllEnabledUsers($executeQuery);
Expand Down
16 changes: 16 additions & 0 deletions Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,22 @@ public function findUserByUsernameOrMail($username, $mail, $executeQuery = true)
return $executeQuery ? $query->getOneOrNullResult() : $query;
}

public function findUserByUsernameAndMail($username, $mail, $executeQuery = true)
{
$dql = '
SELECT u
FROM Claroline\CoreBundle\Entity\User u
WHERE u.username = :username
AND u.mail = :mail
';

$query = $this->_em->createQuery($dql);
$query->setParameter('username', $username);
$query->setParameter('mail', $mail);

return $executeQuery ? $query->getOneOrNullResult() : $query;
}

public function countAllEnabledUsers($executeQuery = true)
{
$dql = '
Expand Down
3 changes: 2 additions & 1 deletion Resources/public/js/administration/adminHomeTabsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
var i = 0;

$('.grid-stack-item').each(function () {
var wdcId = $(this).data('widget-display-config-id');
var wdcId = $(this).data('widget-display-config-id');

if (wdcId !== undefined) {
var column = $(this).attr('data-gs-x');
var row = $(this).attr('data-gs-y');
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/platform.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ add_group_s_confirm_message: 'groupe(s) ajouté(s)'
add_groups: 'Ajouter des groupes'
add_resource: 'Ajouter une ressource'
add_role: 'Ajouter un role'
add_role_to_groups: Ajouter un rôle a %count% groupe(s)
add_role_to_users: Ajouter un rôle a %count% utilisateur(s)
add_role_to_groups: Ajouter un rôle à %count% groupe(s)
add_role_to_users: Ajouter un rôle à %count% utilisateur(s)
add_roles_confirm_message: 'Voulez vous ajouter le(s) role(s) suivant(s) aux %count% élément(s) sélectionné(s): '
add_sub_competence: 'Ajouter une sous-compétence'
add_subcategory: 'Ajouter une sous-catégorie'
Expand Down

0 comments on commit c98162d

Please sign in to comment.