all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [PATCH access-control 1/2] fix #3668: realm sync: add 'remove-vanished' parameter to delete non-existing users
Date: Tue, 9 Nov 2021 18:58:53 +0100	[thread overview]
Message-ID: <0bfbd636-d2da-f69f-8984-76a595207306@proxmox.com> (raw)
In-Reply-To: <20211027125708.1068455-2-d.csapak@proxmox.com>

On 27.10.21 14:57, Dominik Csapak wrote:
> this way, users can use the 'non-full' mode to provide local
> information (like tfa keys), but still remove the users not present in
> the ldap anymore.

ps. missing an patch for pve-docs, in any case...
https://d7.work.tlmp.it:8006/pve-docs/chapter-pveum.html#pveum_ldap_sync

The amount of sync related options is a bit confusing/crowded already now,
so did you thought about just expanding the value set of the `full` property
for that (possibly renaming it to "sync mode" or the like)?

Albeit purge and this new one could be chosen independently, that wouldn't make
the list of choises easier..
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/PVE/API2/Domains.pm | 5 +++--
>  src/PVE/Auth/Plugin.pm  | 7 +++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/API2/Domains.pm b/src/PVE/API2/Domains.pm
> index 9c2b254..55bb7ae 100644
> --- a/src/PVE/API2/Domains.pm
> +++ b/src/PVE/API2/Domains.pm
> @@ -279,10 +279,11 @@ my $update_users = sub {
>      my $users = $usercfg->{users};
>  
>      my $oldusers = {};
> -    if ($opts->{'full'}) {
> -	print "full sync, deleting outdated existing users first\n";
> +    if ($opts->{'full'} || $opts->{'remove-vanished'}) {
> +	print "deleting outdated existing users first\n";
>  	foreach my $userid (sort keys %$users) {
>  	    next if $userid !~ m/\@$realm$/;
> +	    next if !$opts->{full} && defined($synced_users->{$userid});
>  
>  	    $oldusers->{$userid} = delete $users->{$userid};
>  	    if ($opts->{'purge'} && !$synced_users->{$userid}) {
> diff --git a/src/PVE/Auth/Plugin.pm b/src/PVE/Auth/Plugin.pm
> index 1413053..27d6294 100755
> --- a/src/PVE/Auth/Plugin.pm
> +++ b/src/PVE/Auth/Plugin.pm
> @@ -64,6 +64,13 @@ my $realm_sync_options_desc = {
>  	type => 'boolean',
>  	optional => '1',
>      },
> +    'remove-vanished' => {
> +	description => "Only for non-full mode. If set, removes users that are not"
> +	    ." present in the current synced data.",
> +	type => 'boolean',
> +	optional => '1',
> +	default => '0',
> +    },
>      'enable-new' => {
>  	description => "Enable newly synced users immediately.",
>  	type => 'boolean',
> 





  reply	other threads:[~2021-11-09 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 12:57 [pve-devel] [PATCH access-control/manager] improve realm sync Dominik Csapak
2021-10-27 12:57 ` [pve-devel] [PATCH access-control 1/2] fix #3668: realm sync: add 'remove-vanished' parameter to delete non-existing users Dominik Csapak
2021-11-09 17:58   ` Thomas Lamprecht [this message]
2021-10-27 12:57 ` [pve-devel] [PATCH access-control 2/2] realm sync: improve wording in log and description Dominik Csapak
2021-10-27 12:57 ` [pve-devel] [PATCH manager 1/1] ui: realm sync: add 'remove-vanished' option Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bfbd636-d2da-f69f-8984-76a595207306@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal