Commit 2e6a2c9c authored by Debarshi Ray's avatar Debarshi Ray

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.

parent 1705d154
......@@ -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.
......@@ -135,6 +135,8 @@ goa_account_set_provider_icon
......@@ -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,
_("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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment