class DbUserRepository implements UserRepository (View source)

Methods

__construct($db, ConfigurationInterface $config)

No description

User|null
findByUsername(string $username)

Find a user by username

bool
updatePassword(int $userId, string $hashedPassword)

Update a user's password

array|null
getUserById(int $userId)

Get user by ID

string|null
getFullNameById(int $userId)

Get a user's full name by ID

string
getZoneOwnerFullNames(int $domainId)

Get the full names of all owners of a zone, comma-separated

bool
userOwnsZone(int $userId, int $domainId)

Check if a user owns a zone directly or via group membership

array
getUserPermissions(int $userId)

Get all permissions for a specific user

bool
hasAdminPermission(int $userId)

Check if a user has admin permissions

array
getUsersList(int $offset, int $limit)

Get a paginated list of users with zone counts

array
getUsersWithZoneCounts()

Get all users with the number of zones each one owns

array
getUserDetailList(bool $ldapUse, int|null $restrictToUserId, int|null $specific = null, int|null $limit = null, int|null $offset = null, string|null $search = null)

Get detailed user list with template, group, and MFA info

int
getTotalUserCount(int|null $restrictToUserId = null, string|null $search = null)

Get total count of users in the system

bool
deleteUser(int $userId)

Delete a user by ID

array
getUserZones(int $userId)

Get zones owned by a user

bool
transferUserZones(int $fromUserId, int $toUserId)

Transfer zone ownership from one user to another

int
countUberusers()

Count total number of uberusers (super admins) in the system

bool
isLastUberuser(int $userId)

Check if a specific user is an uberuser

bool
isUberuser(int $userId)

Check if a specific user is an uberuser

bool
templateGrantsUberuser(int $permTemplId)

Check whether a permission template grants the uberuser permission

array
getPermissionIdsByName(string $name)

Resolve every permission id carrying a given name

int|null
createUser(array $userData)

Create a new user

array|null
getUserByUsername(string $username)

Get a user by username

array|null
getUserByEmail(string $email)

Get a user by email

int
countUsersByEmail(string $email)

Count how many users share the given email address.

bool
updateUser(int $userId, array $userData)

Update a user's information

bool
assignPermissionTemplate(int $userId, int $permTemplId)

Assign permission template to a user

bool
permissionTemplateExists(int $permTemplId, string|null $templateType = null)

Check if a permission template exists

Details

__construct($db, ConfigurationInterface $config)

No description

Parameters

$db
ConfigurationInterface $config

User|null findByUsername(string $username)

Find a user by username

Parameters

string $username

Username to search for

Return Value

User|null

User object if found, null otherwise

bool updatePassword(int $userId, string $hashedPassword)

Update a user's password

Parameters

int $userId

User ID to update

string $hashedPassword

Hashed password to set

Return Value

bool

True if the password was updated successfully

array|null getUserById(int $userId)

Get user by ID

Parameters

int $userId

User ID to retrieve

Return Value

array|null

User data if found, null otherwise

string|null getFullNameById(int $userId)

Get a user's full name by ID

Parameters

int $userId

User ID to look up

Return Value

string|null

Full name, or null if the user does not exist

string getZoneOwnerFullNames(int $domainId)

Get the full names of all owners of a zone, comma-separated

Parameters

int $domainId

Domain/zone ID

Return Value

string

Comma-separated owner full names, empty string if none

bool userOwnsZone(int $userId, int $domainId)

Check if a user owns a zone directly or via group membership

Parameters

int $userId

User ID to check

int $domainId

Domain/zone ID

Return Value

bool

True if the user owns the zone

array getUserPermissions(int $userId)

Get all permissions for a specific user

Parameters

int $userId

User ID to get permissions for

Return Value

array

Array of permission names

bool hasAdminPermission(int $userId)

Check if a user has admin permissions

Parameters

int $userId

User ID to check

Return Value

bool

True if the user is an admin

array getUsersList(int $offset, int $limit)

Get a paginated list of users with zone counts

Parameters

int $offset

Starting offset for pagination

int $limit

Maximum number of users to return

Return Value

array

Array of user data with zone counts

array getUsersWithZoneCounts()

Get all users with the number of zones each one owns

Return Value

array

Array of user rows [id, username, fullname, email, description, active, numdomains]

array getUserDetailList(bool $ldapUse, int|null $restrictToUserId, int|null $specific = null, int|null $limit = null, int|null $offset = null, string|null $search = null)

Get detailed user list with template, group, and MFA info

Parameters

bool $ldapUse

Whether the LDAP column should be included

int|null $restrictToUserId

Return only this user (for users without view-others permission)

int|null $specific

User ID to fetch (overrides the restriction)

int|null $limit

Number of records to return (optional)

int|null $offset

Starting offset (optional)

string|null $search

Filter on username, full name, email or description

Return Value

array

Array of user details

int getTotalUserCount(int|null $restrictToUserId = null, string|null $search = null)

Get total count of users in the system

Parameters

int|null $restrictToUserId

Count only this user (for users without view-others permission)

string|null $search

Filter on username, full name, email or description

Return Value

int

Total number of users

bool deleteUser(int $userId)

Delete a user by ID

Parameters

int $userId

User ID to delete

Return Value

bool

True if the user was deleted successfully

array getUserZones(int $userId)

Get zones owned by a user

Parameters

int $userId

User ID

Return Value

array

Array of zone data owned by the user

bool transferUserZones(int $fromUserId, int $toUserId)

Transfer zone ownership from one user to another

Parameters

int $fromUserId

Source user ID

int $toUserId

Target user ID

Return Value

bool

True if zones were transferred successfully

int countUberusers()

Count total number of uberusers (super admins) in the system

Return Value

int

Number of uberusers

bool isLastUberuser(int $userId)

Check if a specific user is an uberuser

Parameters

int $userId

Return Value

bool

bool isUberuser(int $userId)

Check if a specific user is an uberuser

Parameters

int $userId

User ID to check

Return Value

bool

True if user is an uberuser

bool templateGrantsUberuser(int $permTemplId)

Check whether a permission template grants the uberuser permission

Parameters

int $permTemplId

Permission template ID

Return Value

bool

True if the template grants user_is_ueberuser

array getPermissionIdsByName(string $name)

Resolve every permission id carrying a given name

perm_items.name has no unique constraint, so a name can map to several rows and all of them grant the permission.

Parameters

string $name

Permission name as stored in perm_items

Return Value

array

Matching permission ids, empty when the permission is absent

int|null createUser(array $userData)

Create a new user

Parameters

array $userData

User data containing username, password, email, etc.

Return Value

int|null

User ID if created successfully, null otherwise

array|null getUserByUsername(string $username)

Get a user by username

Parameters

string $username

Username to search for

Return Value

array|null

User data if found, null otherwise

array|null getUserByEmail(string $email)

Get a user by email

Parameters

string $email

Email to search for

Return Value

array|null

User data if found, null otherwise

int countUsersByEmail(string $email)

Count how many users share the given email address.

Parameters

string $email

Email to search for

Return Value

int

Number of matching users

bool updateUser(int $userId, array $userData)

Update a user's information

Parameters

int $userId

User ID to update

array $userData

Array of user data to update

Return Value

bool

True if updated successfully, false otherwise

bool assignPermissionTemplate(int $userId, int $permTemplId)

Assign permission template to a user

Parameters

int $userId

User ID

int $permTemplId

Permission template ID

Return Value

bool

True if assignment was successful

bool permissionTemplateExists(int $permTemplId, string|null $templateType = null)

Check if a permission template exists

Parameters

int $permTemplId

Permission template ID

string|null $templateType

Optional template_type filter ('user' or 'group')

Return Value

bool

True if the permission template exists (and matches type when set)