Top | ![]() |
![]() |
![]() |
![]() |
An FCmdrUserResolver maps a UNIX user ID to the user's login name and, if possible, the user's real name. This helps resolve "${username}" and "${realname}" variables in settings profiles.
Unless overridden in the fleet-commander.conf file, the default user resolver simply consults the local UNIX password database. But profile user names may not always match 1:1 with local UNIX user names, and so the lookup API is asynchronous in anticipation of custom user resolvers needing to consult some remote service like an LDAP directory.
FCmdrUserResolver * fcmdr_user_resolver_try_new (struct _FCmdrService *service
,const gchar *extension_name
);
Instantiates a subclass of FCmdrUserResolver registered under
extension_name
. If no subclass is registered under extension_name
,
the function returns NULL
.
struct _FCmdrService *
fcmdr_user_resolver_ref_service (FCmdrUserResolver *resolver
);
Returns the FCmdrService that instantiated the resolver
.
The returned FCmdrService is referenced for thread-safety and must be
unreferenced with g_object_unref()
when finished with it.
void fcmdr_user_resolver_lookup (FCmdrUserResolver *resolver
,uid_t uid
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asychronously tries to obtain a user's login name and, if possible, real
name from the given numeric uid
. This may be as simple as consulting
the local UNIX password database or it may involve a network request.
When the operation is finished, callback
will be called. You can then
call fcmdr_user_resolver_lookup_finish()
to get the result of the operation.
resolver |
||
uid |
a UNIX user ID |
|
cancellable |
optional GCancellable object, or |
|
callback |
a GAsyncReadyCallback to call when the request is satisfied |
|
user_data |
data to pass to the callback function |
gboolean fcmdr_user_resolver_lookup_finish (FCmdrUserResolver *resolver
,GAsyncResult *result
,gchar **out_user_name
,gchar **out_real_name
,GError **error
);
Finishes the operation started with fcmdr_user_resolver_lookup()
.
On a successful lookup, the function sets out_user_name
to the user's
login name, out_real_name
to either the user's real name or else NULL
if that information was not available, and returns TRUE
. If the lookup
operation failed, the function sets error
and returns FALSE
.
#define FCMDR_USER_RESOLVER_EXTENSION_POINT_NAME "fcmdr-user-resolver"
Extension point for methods of resolving account user names.
“service”
property“service” FCmdrService *
The owner of this resolver instance.
Flags: Read / Write / Construct Only