diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-01-17 08:33:25 -0600 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-01-17 08:33:25 -0600 |
commit | 59accae1e5b6848592b0beaa6f0e6c481288d357 (patch) | |
tree | ac286b396d0d4df7efbdeba1c080b2a67301c491 /src | |
parent | 916af135916f72b6d09f80d32ae1081e25aa5bdb (diff) |
Don't try to re-add a role the user already has.
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers/x500_mapper.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/handlers/x500_mapper.rs b/src/handlers/x500_mapper.rs index 36ce386..1ec35f2 100644 --- a/src/handlers/x500_mapper.rs +++ b/src/handlers/x500_mapper.rs @@ -113,10 +113,12 @@ impl X500Mapper { if let Some(role) = self.config.students_role { log::info!("adding the role {} to {}", role, member.display_name()); - member - .add_role(&ctx.http, role) - .await - .context("failed to add student role")? + if !member.roles.contains(&role) { + member + .add_role(&ctx.http, role) + .await + .context("failed to add student role")? + } } Ok::<_, anyhow::Error>(()) |