FCmdrUserResolver

FCmdrUserResolver — Resolve account user names

Functions

Properties

FCmdrService * service Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── FCmdrUserResolver

Description

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.

Functions

fcmdr_user_resolver_try_new ()

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.

Parameters

service

a FCmdrService

 

extension_name

a user resolver extension name

 

Returns

a new FCmdrUserResolver, or NULL


fcmdr_user_resolver_ref_service ()

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.

Parameters

resolver

a FCmdrUserResolver

 

Returns

a referenced FCmdrService


fcmdr_user_resolver_lookup ()

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.

Parameters

resolver

a FCmdrUserResolver

 

uid

a UNIX user ID

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

data to pass to the callback function

 

fcmdr_user_resolver_lookup_finish ()

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.

Parameters

resolver

a FCmdrUserResolver

 

result

a GAsyncResult

 

out_user_name

return location for the user's login name, or NULL

 

out_real_name

return location for the user's real name, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Types and Values

FCMDR_USER_RESOLVER_EXTENSION_POINT_NAME

#define FCMDR_USER_RESOLVER_EXTENSION_POINT_NAME "fcmdr-user-resolver"

Extension point for methods of resolving account user names.


struct FCmdrUserResolver

struct FCmdrUserResolver;

Contains only private data that should be read and manipulated using the function below.

Property Details

The “service” property

  “service”                  FCmdrService *

The owner of this resolver instance.

Flags: Read / Write / Construct Only