lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lintel::UserRepository Class Reference

#include <UserRepository.h>

Public Member Functions

 UserRepository (std::shared_ptr< DatabaseConnectionConfigurations > connectionConfigurations, std::shared_ptr< GroupRepository > groupRepository)
 
std::optional< User > of (const std::string &userName)
 
std::vector< User > allOf ()
 
std::vector< User > allOf (const std::string &userNameMatches)
 
Page< User > pageOf (const std::string &userNameMatches, const std::optional< std::string > &afterUserName, std::size_t limit)
 
void createOf (const User &user)
 
void deleteOf (const User &user)
 
void deleteOf (const std::vector< std::string > &userNames)
 
void addGroupsOf (const User &user, const std::set< Group > &groups)
 
void addGroupOf (const User &user, const Group &group)
 
void removeGroupsOf (const User &user, const std::set< Group > &groups)
 
void removeGroupOf (const User &user, const Group &group)
 
void changeFirstNameOf (const User &user, const std::string &firstName)
 
void changeLastNameOf (const User &user, const std::string &lastName)
 
void changeUserNameOf (const User &user, const std::string &userName)
 
void changePasswordOf (const User &user, const std::string &password)
 
void changeEMailOf (const User &user, const std::string &eMail)
 

Detailed Description

Repository for CRUD operations on User entities stored in the database.

Constructor & Destructor Documentation

◆ UserRepository()

lintel::UserRepository::UserRepository ( std::shared_ptr< DatabaseConnectionConfigurations >  connectionConfigurations,
std::shared_ptr< GroupRepository >  groupRepository 
)

Constructor.

Parameters
connectionConfigurationsdatabase connection configuration
groupRepositorygroup repository for resolving group references

Member Function Documentation

◆ addGroupOf()

void lintel::UserRepository::addGroupOf ( const User &  user,
const Group &  group 
)

Add a single group to a user.

Parameters
usertarget user
groupgroup to add

◆ addGroupsOf()

void lintel::UserRepository::addGroupsOf ( const User &  user,
const std::set< Group > &  groups 
)

Add multiple groups to a user.

Parameters
usertarget user
groupsgroups to add

◆ allOf() [1/2]

std::vector< User > lintel::UserRepository::allOf ( )
Returns
all users

◆ allOf() [2/2]

std::vector< User > lintel::UserRepository::allOf ( const std::string &  userNameMatches)
Parameters
userNameMatchesfilter by username (partial match)
Returns
matching users

◆ changeEMailOf()

void lintel::UserRepository::changeEMailOf ( const User &  user,
const std::string &  eMail 
)

Change a user's email address.

Parameters
usertarget user
eMailnew email address

◆ changeFirstNameOf()

void lintel::UserRepository::changeFirstNameOf ( const User &  user,
const std::string &  firstName 
)

Change a user's first name.

Parameters
usertarget user
firstNamenew first name

◆ changeLastNameOf()

void lintel::UserRepository::changeLastNameOf ( const User &  user,
const std::string &  lastName 
)

Change a user's last name.

Parameters
usertarget user
lastNamenew last name

◆ changePasswordOf()

void lintel::UserRepository::changePasswordOf ( const User &  user,
const std::string &  password 
)

Change a user's password.

Parameters
usertarget user
passwordnew password

◆ changeUserNameOf()

void lintel::UserRepository::changeUserNameOf ( const User &  user,
const std::string &  userName 
)

Change a user's username.

Parameters
usertarget user
userNamenew username

◆ createOf()

void lintel::UserRepository::createOf ( const User &  user)

Create a new user.

Parameters
useruser to create

◆ deleteOf() [1/2]

void lintel::UserRepository::deleteOf ( const std::vector< std::string > &  userNames)

Delete users by usernames.

Parameters
userNameslist of usernames to delete

◆ deleteOf() [2/2]

void lintel::UserRepository::deleteOf ( const User &  user)

Delete a user.

Parameters
useruser to delete

◆ of()

std::optional< User > lintel::UserRepository::of ( const std::string &  userName)

Find a user by username.

Parameters
userNamethe username
Returns
the user if found

◆ pageOf()

Page< User > lintel::UserRepository::pageOf ( const std::string &  userNameMatches,
const std::optional< std::string > &  afterUserName,
std::size_t  limit 
)

Keyset-paginated user query ordered by user_name ascending.

Parameters
userNameMatchesfilter by username (partial match); empty string disables filtering
afterUserNameexclusive lower bound; pass the previous page's nextAfter value (nullopt for the first page)
limitmaximum number of users per page
Returns
one page of users plus continuation info

◆ removeGroupOf()

void lintel::UserRepository::removeGroupOf ( const User &  user,
const Group &  group 
)

Remove a single group from a user.

Parameters
usertarget user
groupgroup to remove

◆ removeGroupsOf()

void lintel::UserRepository::removeGroupsOf ( const User &  user,
const std::set< Group > &  groups 
)

Remove multiple groups from a user.

Parameters
usertarget user
groupsgroups to remove

The documentation for this class was generated from the following file: