| gumd API Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | ||||
#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);
"gid" guint : Read "groupname" gchar* : Read / Write "grouptype" guint : Read / Write "secret" gchar* : Read / Write
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
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.
struct GumGroupClass {
GObjectClass parent_class;
};
Opaque structure for the class.
GObjectClass |
parent class object |
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.
|
GumGroup object to be added; object should have valid "groupname" and "grouptype" properties. |
|
GumGroupCb to be invoked when group is added |
|
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. |
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.
|
GumGroup object where new member is to be added; object should have valid "gid" property. |
|
user id of the member to be added to the group |
|
user will be added with admin privileges for the group if set to TRUE |
|
GumGroupCb to be invoked when member is added |
|
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. |
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_add_sync (GumGroup *self);
This method adds the group over the DBus synchronously.
|
GumGroup object to be added; object should have valid "groupname" and "grouptype" properties. |
Returns : |
returns TRUE if successful, FALSE otherwise. |
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.
|
GumGroupCb to be invoked when new group object is created |
|
user data |
Returns : |
GumGroup newly created object. [transfer full] |
GumGroup * gum_group_create_sync ();
This method creates a new remote group object over the DBus synchronously.
Returns : |
GumGroup newly created object. [transfer full] |
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.
|
GumGroup object to be deleted; object should have valid "gid" property. |
|
GumGroupCb to be invoked when group is deleted |
|
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. |
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.
|
GumGroup object where member is to be deleted from; object should have valid "gid" property. |
|
user id of the member to be deleted from the group |
|
GumGroupCb to be invoked when member is deleted |
|
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. |
gboolean gum_group_delete_member_sync (GumGroup *self,uid_t uid);
This method deletes new member from the group over the DBus synchronously.
gboolean gum_group_delete_sync (GumGroup *self);
This method deletes the group 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.
|
group id for the group |
|
GumGroupCb to be invoked when group object is fetched |
|
user data |
Returns : |
GumGroup object. [transfer full] |
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.
|
name of the group |
|
GumGroupCb to be invoked when group object is fetched |
|
user data |
Returns : |
GumGroup object. [transfer full] |
GumGroup * gum_group_get_by_name_sync (const gchar *groupname);
This method gets the group object attached to groupname over the DBus synchronously.
|
name of the group |
Returns : |
GumGroup object. [transfer full] |
GumGroup * gum_group_get_sync (gid_t gid);
This method gets the group object attached to gid over the DBus synchronously.
|
group id for the group |
Returns : |
GumGroup object. [transfer full] |
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.
|
GumGroup object to be updated; object should have valid "gid" property. |
|
GumGroupCb to be invoked when group is updated |
|
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. |
"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
"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: ""
"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
"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: ""