GumGroup

GumGroup — provides interface for managing group's data

Synopsis

#include <gum/gum-group.h>

struct              GumGroup;
void                (*GumGroupCb)                       (GumGroup *group,
                                                         const GError *error,
                                                         gpointer user_data);
struct              GumGroupClass;
gboolean            gum_group_add                       (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
gboolean            gum_group_add_member                (GumGroup *self,
                                                         uid_t uid,
                                                         gboolean add_as_admin,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
gboolean            gum_group_add_member_sync           (GumGroup *self,
                                                         uid_t uid,
                                                         gboolean add_as_admin);
gboolean            gum_group_add_sync                  (GumGroup *self);
GumGroup *          gum_group_create                    (GumGroupCb callback,
                                                         gpointer user_data);
GumGroup *          gum_group_create_sync               ();
gboolean            gum_group_delete                    (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
gboolean            gum_group_delete_member             (GumGroup *self,
                                                         uid_t uid,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
gboolean            gum_group_delete_member_sync        (GumGroup *self,
                                                         uid_t uid);
gboolean            gum_group_delete_sync               (GumGroup *self);
GumGroup *          gum_group_get                       (gid_t gid,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
GumGroup *          gum_group_get_by_name               (const gchar *groupname,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
GumGroup *          gum_group_get_by_name_sync          (const gchar *groupname);
GumGroup *          gum_group_get_sync                  (gid_t gid);
gboolean            gum_group_update                    (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);
gboolean            gum_group_update_sync               (GumGroup *self);

Object Hierarchy

  GObject
   +----GumGroup

Properties

  "gid"                      guint                 : Read
  "groupname"                gchar*                : Read / Write
  "grouptype"                guint                 : Read / Write
  "secret"                   gchar*                : Read / Write

Description

GumGroup provides interface for adding, removing and updating group. Group's information can also be retrieved using this interface. Only privileged user can access the interface when system-bus is used for communication with the user management daemon.

Following code snippet demonstrates how to create a new remote group object:

 GumGroup *group = NULL;

 group = gum_group_create_sync ();

 // use the object

 // destroy the object
 g_object_unref (group);

Similarly, new group can be added as:

 GumGroup *group = NULL;
 gboolean rval = FALSE;

 group = gum_group_create_sync ();

 // set group properties
 g_object_set (G_OBJECT (group), "groupname", "group1", "secret", "123456",
  "grouptype", GUM_GROUPTYPE_USER, NULL);

 // add group
 rval = gum_group_add_sync (user);

 // destroy the object
 g_object_unref (group);

For more details, see command-line utility implementation here: gum-utils

Details

struct GumGroup

struct GumGroup;

Opaque structure for the object.


GumGroupCb ()

void                (*GumGroupCb)                       (GumGroup *group,
                                                         const GError *error,
                                                         gpointer user_data);

GumGroupCb defines the callback which is used when group object is created, added, deleted or updated or new members are added to the group.

group :

GumGroup object which is used in the request. [transfer none]

error :

GError object. In case of error, error will be non-NULL. [transfer none]

user_data :

user data passed onto the request

struct GumGroupClass

struct GumGroupClass {
    GObjectClass parent_class;
};

Opaque structure for the class.

GObjectClass parent_class;

parent class object

gum_group_add ()

gboolean            gum_group_add                       (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method adds the group over the DBus asynchronously. Callback is used to notify when the group is added.

self :

GumGroup object to be added; object should have valid "groupname" and "grouptype" properties.

callback :

GumGroupCb to be invoked when group is added

user_data :

user data

Returns :

returns TRUE if the request has been pushed and is waiting for the response, FALSE otherwise. No callback is triggered, in case the function returns FALSE.

gum_group_add_member ()

gboolean            gum_group_add_member                (GumGroup *self,
                                                         uid_t uid,
                                                         gboolean add_as_admin,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method adds new member to the group over the DBus asynchronously. Callback is used to notify when the member is added.

self :

GumGroup object where new member is to be added; object should have valid "gid" property.

uid :

user id of the member to be added to the group

add_as_admin :

user will be added with admin privileges for the group if set to TRUE

callback :

GumGroupCb to be invoked when member is added

user_data :

user data

Returns :

returns TRUE if the request has been pushed and is waiting for the response, FALSE otherwise. No callback is triggered, in case the function returns FALSE.

gum_group_add_member_sync ()

gboolean            gum_group_add_member_sync           (GumGroup *self,
                                                         uid_t uid,
                                                         gboolean add_as_admin);

This method adds new member to the group over the DBus synchronously.

self :

GumGroup object where new member is to be added; object should have valid "gid" property.

uid :

user id of the member to be added to the group

add_as_admin :

user will be added with admin privileges for the group if set to TRUE

Returns :

returns TRUE if successful, FALSE otherwise.

gum_group_add_sync ()

gboolean            gum_group_add_sync                  (GumGroup *self);

This method adds the group over the DBus synchronously.

self :

GumGroup object to be added; object should have valid "groupname" and "grouptype" properties.

Returns :

returns TRUE if successful, FALSE otherwise.

gum_group_create ()

GumGroup *          gum_group_create                    (GumGroupCb callback,
                                                         gpointer user_data);

This method creates a new remote group object over the DBus asynchronously. Callback is used to notify when the remote object is fully created and accessible.

callback :

GumGroupCb to be invoked when new group object is created

user_data :

user data

Returns :

GumGroup newly created object. [transfer full]

gum_group_create_sync ()

GumGroup *          gum_group_create_sync               ();

This method creates a new remote group object over the DBus synchronously.

Returns :

GumGroup newly created object. [transfer full]

gum_group_delete ()

gboolean            gum_group_delete                    (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method deletes the group over the DBus asynchronously. Callback is used to notify when the group is deleted.

self :

GumGroup object to be deleted; object should have valid "gid" property.

callback :

GumGroupCb to be invoked when group is deleted

user_data :

user data

Returns :

returns TRUE if the request has been pushed and is waiting for the response, FALSE otherwise. No callback is triggered, in case the function returns FALSE.

gum_group_delete_member ()

gboolean            gum_group_delete_member             (GumGroup *self,
                                                         uid_t uid,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method deletes new member from the group over the DBus asynchronously. Callback is used to notify when the member is deleted.

self :

GumGroup object where member is to be deleted from; object should have valid "gid" property.

uid :

user id of the member to be deleted from the group

callback :

GumGroupCb to be invoked when member is deleted

user_data :

user data

Returns :

returns TRUE if the request has been pushed and is waiting for the response, FALSE otherwise. No callback is triggered, in case the function returns FALSE.

gum_group_delete_member_sync ()

gboolean            gum_group_delete_member_sync        (GumGroup *self,
                                                         uid_t uid);

This method deletes new member from the group over the DBus synchronously.

self :

GumGroup object where member is to be deleted from; object should have valid "gid" property.

uid :

user id of the member to be deleted from the group

Returns :

returns TRUE if successful, FALSE otherwise.

gum_group_delete_sync ()

gboolean            gum_group_delete_sync               (GumGroup *self);

This method deletes the group over the DBus synchronously.

self :

GumGroup object to be deleted; object should have valid "gid" property.

Returns :

returns TRUE if successful, FALSE otherwise.

gum_group_get ()

GumGroup *          gum_group_get                       (gid_t gid,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method gets the group object attached to gid over the DBus asynchronously. Callback is used to notify when the remote object is fully created and accessible.

gid :

group id for the group

callback :

GumGroupCb to be invoked when group object is fetched

user_data :

user data

Returns :

GumGroup object. [transfer full]

gum_group_get_by_name ()

GumGroup *          gum_group_get_by_name               (const gchar *groupname,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method gets the group object attached to groupname over the DBus asynchronously. Callback is used to notify when the remote object is fully created and accessible.

groupname :

name of the group

callback :

GumGroupCb to be invoked when group object is fetched

user_data :

user data

Returns :

GumGroup object. [transfer full]

gum_group_get_by_name_sync ()

GumGroup *          gum_group_get_by_name_sync          (const gchar *groupname);

This method gets the group object attached to groupname over the DBus synchronously.

groupname :

name of the group

Returns :

GumGroup object. [transfer full]

gum_group_get_sync ()

GumGroup *          gum_group_get_sync                  (gid_t gid);

This method gets the group object attached to gid over the DBus synchronously.

gid :

group id for the group

Returns :

GumGroup object. [transfer full]

gum_group_update ()

gboolean            gum_group_update                    (GumGroup *self,
                                                         GumGroupCb callback,
                                                         gpointer user_data);

This method updates the group over the DBus asynchronously. Callback is used to notify when the group is updated. The properties which can be updated are: secret.

self :

GumGroup object to be updated; object should have valid "gid" property.

callback :

GumGroupCb to be invoked when group is updated

user_data :

user data

Returns :

returns TRUE if the request has been pushed and is waiting for the response, FALSE otherwise. No callback is triggered, in case the function returns FALSE.

gum_group_update_sync ()

gboolean            gum_group_update_sync               (GumGroup *self);

This method updates the group over the DBus synchronously. The properties which can be updated are: secret.

self :

GumGroup object to be updated; object should have valid "gid" property.

Returns :

returns TRUE if successful, FALSE otherwise.

Property Details

The "gid" property

  "gid"                      guint                 : Read

This property holds a unique group identity for the group as assigned by the underlying framework, which is always be in range [0, MAXUINT].

Default value: 4294967295


The "groupname" property

  "groupname"                gchar*                : Read / Write

This property holds the name of given to the group when the group is added. Allowed pattern for groupname is: "^[A-Za-z_][A-Za-z0-9_.-]*[A-Za-z0-9_.$-]\\?$".

Default value: ""


The "grouptype" property

  "grouptype"                guint                 : Read / Write

This property holds a group type that the object corresponds to. Valid values of group types are as specified in GumGroupType. "grouptype" must be specified when adding a new group.

Allowed values: <= 65535

Default value: 0


The "secret" property

  "secret"                   gchar*                : Read / Write

This property holds the secret as chosen. Secret should not contain any control chars (0x00-0x1F,0x7F) or colon (':' 0x3A).

Default value: ""