[gnome-online-accounts] Support locked accounts
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] Support locked accounts
- Date: Tue, 30 Sep 2014 14:26:41 +0000 (UTC)
commit 2e6a2c9c7e1085f96342ce9db831e2432a75b556
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Sep 30 14:18:03 2014 +0200
Support locked accounts
Locked accounts are those that have been pre-configured by the system
administrator. Users are discouraged from removing these, which is why
org.gnome.OnlineAccounts.Account.Remove will refuse to do so. One can
work around this by manually editing accounts.conf.
Fixes: https://bugzilla.gnome.org/737656
data/dbus-interfaces.xml | 11 +++++++++++
doc/goa-sections.txt | 2 ++
src/daemon/goadaemon.c | 14 ++++++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
index 5bf26e9..d6c0486 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -66,6 +66,17 @@
-->
<property name="Id" type="s" access="read"/>
+ <!-- IsLocked:
+ @since: 3.16.0
+
+ Whether or not the user is discouraged from removing this account.
+
+ Locked accounts can be those that there added by the administrator to
+ pre-configure systems in an enterprise deployment. If %TRUE, the UI
+ should prevent, or atleast discourage, removal of these accounts.
+ -->
+ <property name="IsLocked" type="b" access="read"/>
+
<!-- IsTemporary:
Whether or not the account is remembered from session to session.
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index 3a79a52..12e5ca7 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -135,6 +135,8 @@ goa_account_set_provider_icon
goa_account_get_id
goa_account_dup_id
goa_account_set_id
+goa_account_get_is_locked
+goa_account_set_is_locked
goa_account_get_is_temporary
goa_account_set_is_temporary
goa_account_get_attention_needed
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 94da46c..c2a77ed 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -431,6 +431,7 @@ update_account_object (GoaDaemon *daemon,
{
GoaAccount *account;
GoaProvider *provider;
+ gboolean is_locked;
gboolean ret;
gchar *identity;
gchar *presentation_identity;
@@ -458,6 +459,7 @@ update_account_object (GoaDaemon *daemon,
type = g_key_file_get_string (key_file, group, "Provider", NULL);
identity = g_key_file_get_string (key_file, group, "Identity", NULL);
presentation_identity = g_key_file_get_string (key_file, group, "PresentationIdentity", NULL);
+ is_locked = g_key_file_get_boolean (key_file, group, "IsLocked", NULL);
if (just_added)
{
account = goa_account_skeleton_new ();
@@ -479,6 +481,7 @@ update_account_object (GoaDaemon *daemon,
goa_account_set_provider_type (account, type);
goa_account_set_identity (account, identity);
goa_account_set_presentation_identity (account, presentation_identity);
+ goa_account_set_is_locked (account, is_locked);
error = NULL;
if (!goa_provider_build_object (provider, object, key_file, group, daemon->connection, just_added, &error))
@@ -957,6 +960,17 @@ on_account_handle_remove (GoaAccount *account,
key_file = NULL;
data = NULL;
+ if (goa_account_get_is_locked (account))
+ {
+ error = NULL;
+ g_set_error_literal (&error,
+ GOA_ERROR,
+ GOA_ERROR_NOT_SUPPORTED,
+ _("IsLocked property is set for account"));
+ g_dbus_method_invocation_take_error (invocation, error);
+ goto out;
+ }
+
/* update key-file - right now we only support removing the account
* if the entry is in ~/.config/goa-1.0/accounts.conf
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]