mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 14:54:57 +00:00
Feature: [admin] add an export list of all permissions associated to
each user
This commit is contained in:
@@ -123,6 +123,34 @@ final class UserRepository implements UserRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function findAllUserACLAsArray(): iterable
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.label,
|
||||
u.enabled,
|
||||
c.id AS center_id,
|
||||
c.name AS center_name,
|
||||
pg.id AS permissionsGroup_id,
|
||||
pg.name AS permissionsGroup_name
|
||||
FROM users u
|
||||
LEFT JOIN user_groupcenter ON u.id = user_groupcenter.user_id
|
||||
LEFT JOIN group_centers ON user_groupcenter.groupcenter_id = group_centers.id
|
||||
LEFT JOIN centers c on group_centers.center_id = c.id
|
||||
LEFT JOIN permission_groups pg on group_centers.permissionsgroup_id = pg.id
|
||||
ORDER BY u.username, c.name, pg.name
|
||||
SQL;
|
||||
|
||||
$query = $this->entityManager->getConnection()->executeQuery($sql);
|
||||
|
||||
foreach ($query->iterateAssociative() as $u) {
|
||||
yield $u;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed|null $limit
|
||||
* @param mixed|null $offset
|
||||
|
@@ -28,11 +28,25 @@ interface UserRepositoryInterface extends ObjectRepository
|
||||
public function countByUsernameOrEmail(string $pattern): int;
|
||||
|
||||
/**
|
||||
* Find a list of all users.
|
||||
*
|
||||
* The main purpose for this method is to provide a lightweight list of all users in the database.
|
||||
*
|
||||
* @param string $lang The lang to display all the translatable string (no fallback if not present)
|
||||
* @return iterable<array{id: int, username: string, email: string, enable: bool, civility_id: int, civility_abbreviation: string, civility_name: string, label: string, mainCenter_id: int, mainCenter_name: string, mainScope_id: int, mainScope_name: string, userJob_id: int, userJob_name: string, currentLocation_id: int, currentLocation_name: string, mainLocation_id: int, mainLocation_name: string, absenceStart: \DateTimeImmutable}>
|
||||
* @return iterable<array{id: int, username: string, email: string, enabled: bool, civility_id: int, civility_abbreviation: string, civility_name: string, label: string, mainCenter_id: int, mainCenter_name: string, mainScope_id: int, mainScope_name: string, userJob_id: int, userJob_name: string, currentLocation_id: int, currentLocation_name: string, mainLocation_id: int, mainLocation_name: string, absenceStart: \DateTimeImmutable}>
|
||||
*/
|
||||
public function findAllAsArray(string $lang): iterable;
|
||||
|
||||
/**
|
||||
* Find a list of permissions associated to each users.
|
||||
*
|
||||
* The main purpose for this method is to provide a lightweight list of all permissions group and center
|
||||
* associated to each user.
|
||||
*
|
||||
* @return iterable<array{id: int, username: string, email: string, enabled: bool, center_id: int, center_name: string, permissionsGroup_id: int, permissionsGroup_name: string}>
|
||||
*/
|
||||
public function findAllUserACLAsArray(): iterable;
|
||||
|
||||
/**
|
||||
* @return array|User[]
|
||||
*/
|
||||
|
Reference in New Issue
Block a user