Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

API Documentation

Documentation for developing SailfishOS applications
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Public Slots
  • Signals
  • Detailed Description

SailfishUserManager Class

The SailfishUserManager provides tools for user management. More...

Header: #include <SailfishUserManager>
  • List of all members, including inherited members

Public Slots

void addToGroups(uint uid, const QStringList &groups)
uint addUser(const QString &name)
uint currentUser()
QString currentUserUuid()
void enableGuestUser(bool enable)
void modifyUser(uint uid, const QString &new_name)
void removeFromGroups(uint uid, const QStringList &groups)
void removeUser(uint uid)
void setCurrentUser(uint uid)
QString userUuid(uint uid)
QList<SailfishUserManagerEntry> users()
QStringList usersGroups(uint uid)

Signals

void aboutToChangeCurrentUser(uint uid)
void currentUserChangeFailed(uint uid)
void currentUserChanged(uint uid)
void guestUserEnabled(bool enabled)
void userAdded(const SailfishUserManagerEntry &user)
void userModified(uint uid, const QString &new_name)
void userRemoved(uint uid)

Detailed Description

The SailfishUserManager provides tools for user management.

This is a D-Bus interface to list, create, remove and modify users. It is provided by org.sailfishos.usermanager service on system bus with path / and interface org.sailfishos.usermanager.

Useful defines, SailfishUserManagerEntry struct and serializing operators are provided by <sailfishusermanagerinterface.h>. It can be used directly with Qt projects utilizing this interface.

Some operations may return QDBusError::AccessDenied if caller is not authorized to do them and QDBusError::InvalidArgs if arguments are not acceptable.

Member Function Documentation

[signal] void SailfishUserManager::aboutToChangeCurrentUser(uint uid)

Triggered when system is about to change current user to user with uid.

This is mainly useful for user interface to show information about switching users. User session is ended a moment later and currentUserChanged will follow this signal.

[slot] void SailfishUserManager::addToGroups(uint uid, const QStringList &groups)

Adds user with given uid to groups.

This is used to add permissions for user. All groups must begin with sailfish- or account- prefix.

This may return errors SailfishUserManagerErrorUserNotFound and SailfishUserManagerErrorAddToGroupFailed.

[slot] uint SailfishUserManager::addUser(const QString &name)

Creates user with name as real name.

New users can not be created if there are already maximum number of users. Guest user is not counted to this maximum. name must not be empty and it may not contain : or , characters. In practice it is recommended to only have letters, numbers, spaces, dots and dashes in name.

Returns UID (User IDentifier) of the new user. Use users to get username if needed.

This may return errors SailfishUserManagerErrorMaxUsersReached, SailfishUserManagerErrorUserAddFailed, SailfishUserManagerErrorUserModifyFailed and SailfishUserManagerErrorHomeCreateFailed.

[slot] uint SailfishUserManager::currentUser()

Returns current user's UID (User IDentifier).

Current user is the user that is using the device, i.e. is active on seat0.

See also setCurrentUser().

[signal] void SailfishUserManager::currentUserChangeFailed(uint uid)

Triggered when changing current user fails.

This follows aboutToChangeCurrentUser when changing current user to user with uid fails.

The system may be in unusable state after this signal or it may have recovered successfully. Rebooting device usually recovers this.

[signal] void SailfishUserManager::currentUserChanged(uint uid)

Triggered when current user is changed.

Current user is set to user with uid.

[slot] QString SailfishUserManager::currentUserUuid()

Returns UUID (Universally Unique IDentifier) for current user.

This may return errors SailfishUserManagerErrorGetUidFailed and SailfishUserManagerErrorGetUuidFailed.

[slot] void SailfishUserManager::enableGuestUser(bool enable)

Enables or disables guest user.

Argument enable chooses whether guest user should be enabled or not.

This may return errors SailfishUserManagerErrorUserAddFailed, SailfishUserManagerErrorUserModifyFailed and SailfishUserManagerErrorUserRemoveFailed.

[signal] void SailfishUserManager::guestUserEnabled(bool enabled)

Triggered when guest user is enabled or disabled.

If enabled is true, guest user is enabled, otherwise it is disabled.

[slot] void SailfishUserManager::modifyUser(uint uid, const QString &new_name)

Changes real name to new_name for user with given uid.

[slot] void SailfishUserManager::removeFromGroups(uint uid, const QStringList &groups)

Removes user with uid from groups.

This is used to remove permissions from user. All groups must begin with sailfish- or account- prefix.

This may return errors SailfishUserManagerErrorUserNotFound and SailfishUserManagerErrorRemoveFromGroupFailed.

[slot] void SailfishUserManager::removeUser(uint uid)

Removes user with given uid from the system.

Only additional users can be removed. Current user or Device owner can not be removed. See enableGuestUser for disabling guest user.

Warning: Removing a user destroys all data for that user.

This may return error SailfishUserManagerErrorUserRemoveFailed.

[slot] void SailfishUserManager::setCurrentUser(uint uid)

Sets current user to user with given uid.

This will end current user session and start user session for uid which must be different from current user's UID.

This may return errors SailfishUserManagerErrorGetUidFailed, SailfishUserManagerErrorBusy and SailfishUserManagerErrorUserNotFound.

See also currentUser().

[signal] void SailfishUserManager::userAdded(const SailfishUserManagerEntry &user)

Triggered when a new user has been added.

User information is contained in user.

See also SailfishUserManagerEntry.

[signal] void SailfishUserManager::userModified(uint uid, const QString &new_name)

Triggered when user's real name has been changed.

User with uid has new_name as their new real name.

[signal] void SailfishUserManager::userRemoved(uint uid)

Triggered when user with uid has been removed.

[slot] QString SailfishUserManager::userUuid(uint uid)

Returns UUID (Universally Unique IDentifier) for user with given uid.

This may return error SailfishUserManagerErrorGetUuidFailed.

[slot] QList<SailfishUserManagerEntry> SailfishUserManager::users()

List users on device.

Returns list of SailfishUserManagerEntry structs.

If list of users can not be fetched this returns error QDBusError::Failed.

[slot] QStringList SailfishUserManager::usersGroups(uint uid)

Returns groups for user with given uid.

  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn