Defines a user management API. This module defines functions only for managing signed-in users. Platforms that do not have users must still implement this API, always reporting a single user that is current and signed in.
These APIs are NOT expected to be thread-safe, so either call them from a single thread, or perform proper synchronization around all calls.
Well-defined value for an invalid user.
A set of string properties that can be queried on a user.
kSbUserPropertyAvatarUrl
The URL to the avatar for a user. Avatars are not provided on all platforms.
kSbUserPropertyHomeDirectory
The path to a user's home directory, if supported on this platform.
kSbUserPropertyUserName
The username of a user, which may be the same as the User ID, or it may be friendlier.
kSbUserPropertyUserId
A unique user ID of a user.
A handle to a user.
typedef SbUserPrivate* SbUser
Gets the current primary user, if one exists. This is the user that is determined, in a platform-specific way, to be the primary user controlling the application. For example, the determination might be made because that user launched the app, though it should be made using whatever criteria are appropriate for the platform.
It is expected that there will be a unique SbUser per signed-in user, and that the referenced objects will persist for the lifetime of the app.
SbUser SbUserGetCurrent()
Retrieves the value of property_id
for user
and places it in out_value
. The function returns:
true
if the property value is retrieved successfully
false
if user
is invalid; if property_id
isn't recognized, supported, or set for user
; or if value_size
is too small.
user
: The user for which property size data is being retrieved. property_id
: The property for which the data is requested. out_value
: The retrieved property value. value_size
: The size of the retrieved property value.
bool SbUserGetProperty(SbUser user, SbUserPropertyId property_id, char *out_value, int value_size)
Returns the size of the value of property_id
for user
, INCLUDING the terminating null character. The function returns 0
if user
is invalid or if property_id
is not recognized, supported, or set for the user.
user
: The user for which property size data is being retrieved. property_id
: The property for which the data is requested.
int SbUserGetPropertySize(SbUser user, SbUserPropertyId property_id)
Gets a list of up to users_size
signed-in users and places the results in out_users
. The return value identifies the actual number of signed-in users, which may be greater or less than users_size
.
It is expected that there will be a unique SbUser
per signed-in user and that the referenced objects will persist for the lifetime of the app.
out_users
: Handles for the retrieved users. users_size
: The maximum number of signed-in users to retrieve.
int SbUserGetSignedIn(SbUser *out_users, int users_size)
Returns whether the given user handle is valid.
static bool SbUserIsValid(SbUser user)