API Documentation
Documentation for developing SailfishOS applicationsUserManager Class
(Sailfish::Mdm::UserManager)Manages system users. To use this class, clients must add the following to their qmake project: More...
Header: | #include <mdm-usermanager.h> |
Public Functions
UserManager(QObject *parent = 0) | |
virtual | ~UserManager() |
bool | addToGroups(uint uid, const QStringList &groups) |
uint | addUser(const QString &userName) |
uint | currentUser() |
QString | currentUserUuid() |
bool | enableGuestUser(bool enable) |
bool | modifyUser(uint uid, const QString &newFullName) |
bool | removeFromGroups(uint uid, const QStringList &groups) |
bool | removeUser(uint uid) |
bool | setCurrentUser(uint uid) |
QString | userUuid(uint uid) |
QList<SailfishUserManagerEntry> | users() |
QStringList | usersGroups(uint uid) |
Detailed Description
Manages system users. To use this class, clients must add the following to their qmake project:
CONFIG += link_pkgconfig PKGCONFIG += sailfishmdm
and then #include <mdm-usermanager.h>
.
Example of usage:
#include <mdm-usermanager.h> void addUser() { Sailfish::Mdm::UserManager user; qInfo() << user.addUser("userName"); }
Member Function Documentation
UserManager::UserManager(QObject *parent = 0)
Constructs a UserManager instance with the given parent.
[virtual]
UserManager::~UserManager()
Destroys the UserManager instance.
bool UserManager::addToGroups(uint uid, const QStringList &groups)
Adds groups for user with uid. User is not added to any of the groups if adding the user to even one of the groups fails.
uint UserManager::addUser(const QString &userName)
Creates the new user with userName. Returns UID of the created new user, if the user was added successful.
uint UserManager::currentUser()
Returns the current user id.
See also setCurrentUser().
QString UserManager::currentUserUuid()
Returns the current user uid.
bool UserManager::enableGuestUser(bool enable)
Enables or disables guest user depending on the enable.
bool UserManager::modifyUser(uint uid, const QString &newFullName)
Changes real name to newFullName for user with given uid, if the modification was successfully applied.
bool UserManager::removeFromGroups(uint uid, const QStringList &groups)
Remove groups for user with uid.
bool UserManager::removeUser(uint uid)
Removes the user with uid. Returns true
if the user removal was successful, false
otherwise.
bool UserManager::setCurrentUser(uint uid)
Switch to the user with passed uid. Specified user will be used on the next user session.
Note: This method does not reboot the device.
See also currentUser().
QString UserManager::userUuid(uint uid)
Returns the uuid of the user with uid.
QList<SailfishUserManagerEntry> UserManager::users()
Returns a list of SailfishUserManagerEntry structs.
QStringList UserManager::usersGroups(uint uid)
Returns a list of user groups with uid.