-
-
Notifications
You must be signed in to change notification settings - Fork 108
Description
I have a scenario where I would like to isolate users to only be able to run a command against specific external sources like AD for thier own user accounts, things like Unlock-Account and ability to Reset their Password via a custom script that we've built to ensure that passwords are falling within required security ranges.
Expected Behaviour
User A issues !UnlockMyADAccount -Domain DomainA to get PoshBot to run a carefully wrapped command that should use internal logic in the !UnlockMyADAccount command to grab the email address of the Slack User that issued the command to then pass this to an internally wrapped version of another command as this is the easiest way that we can ensure that the user issuing the command is doing so to the same user account in specific AD being targeted
Current Behaviour
Seems that this should be possible as Slack does give the email property of users back when requested using the PSSlack module.
Possible Solution
Add a ReturnSlackUserEmail method similar to this
PoshBot/PoshBot/Implementations/Slack/SlackBackend.ps1
Lines 643 to 657 in c592cb9
| [SlackPerson]GetUser([string]$UserId) { | |
| $user = $this.Users[$UserId] | |
| if (-not $user) { | |
| $this.LogDebug([LogSeverity]::Warning, "User [$UserId] not found. Refreshing users") | |
| $this.LoadUsers() | |
| $user = $this.Users[$UserId] | |
| } | |
| if ($user) { | |
| $this.LogDebug("Resolved user [$UserId]", $user) | |
| } else { | |
| $this.LogDebug([LogSeverity]::Warning, "Could not resolve user [$UserId]") | |
| } | |
| return $user | |
| } |
It's totally possible that on my quick scan this is something that is already there and that I've totally missed it so thought best to raise this as an issue in case could be pointed the right way
Your Environment
- Module version used: 0.10.2
- Operating System and PowerShell version: Windows 10 1709 - PS - 5.1.16299.431