| Top |
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-utilsvoid (*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.
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.
GumGroup * gum_group_create_sync ();
This method creates a new remote group object over the DBus synchronously.
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 |
GumGroup *
gum_group_get_sync (gid_t gid);
This method gets the group object attached to gid over the DBus synchronously.
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 |
GumGroup *
gum_group_get_by_name_sync (const gchar *groupname);
This method gets the group object attached to groupname over the DBus synchronously.
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 |
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. |
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 |
gboolean
gum_group_delete_sync (GumGroup *self);
This method deletes the group over the DBus synchronously.
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 |
gboolean
gum_group_update_sync (GumGroup *self);
This method updates the group over the DBus synchronously. The properties which can be updated are: secret.
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 |
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.
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 |
“gid” property“gid” guint
This property holds a unique group identity for the group as assigned by the underlying framework, which is always be in range [0, MAXUINT].
Flags: Read
Default value: 4294967295
“groupname” property“groupname” gchar *
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_.$-]\?$".
Flags: Read / Write
Default value: ""
“grouptype” property“grouptype” guint
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.
Flags: Read / Write
Allowed values: <= 65535
Default value: 0
“secret” property“secret” gchar *
This property holds the secret as chosen. Secret should not contain any control chars (0x00-0x1F,0x7F) or colon (':' 0x3A).
Flags: Read / Write
Default value: ""