Skip to content

Commit

Permalink
Merge pull request #631 from TheJumpCloud/CUT-4468-Cascade-Manager-Re…
Browse files Browse the repository at this point in the history
…move-JCUser

Cut-4468-cascade-manager-remove-jc-user
kmaranionjc authored Dec 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4400a83 + d86b6e2 commit 3286ca6
Showing 9 changed files with 676 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ mac

```
# DMG Download URL
DownloadUrl="https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
DownloadUrl="https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg"
### Modify below this line at your own risk!
@@ -173,7 +173,7 @@ echo "Deleted /tmp/$TempFolder"

#### Description

Installs Google Chrome from the DMG file available for download from the link: `https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg`.
Installs Google Chrome from the DMG file available for download from the link: `https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg`.

This command creates a temporary folder in the /tmp directory and to downloads the DMG file to this folder.

44 changes: 42 additions & 2 deletions PowerShell/JumpCloud Module/Docs/Remove-JCUser.md
Original file line number Diff line number Diff line change
@@ -14,12 +14,14 @@ Removes a JumpCloud User

### Username (Default)
```
Remove-JCUser [-Username] <String> [-force] [<CommonParameters>]
Remove-JCUser [-Username] <String> [-force] [-CascadeManager <String>]
[<CommonParameters>]
```

### UserID
```
Remove-JCUser -UserID <String> [-ByID] [-force] [<CommonParameters>]
Remove-JCUser -UserID <String> [-ByID] [-force] [-CascadeManager <String>]
[<CommonParameters>]
```

## DESCRIPTION
@@ -40,6 +42,28 @@ PS C:\> Remove-JCUser cclemons -Force
```

Removes the JumpCloud User with Username 'cclemons' using the -Force Parameter. A warning message will not be presented to confirm this operation.
If the cclemons is a manager of other users, the `Force` parameter will clear cclemons' subordinates `manager` field. In other words if a user is managed by cclemons, removing cclemons will also remove that user's manager field in JumpCloud.

### Example 3
```powershell
PS C:\> Remove-JCUser cclemons -CascadeManager null
```

Removes the Jumpcloud user with Username 'cclemons'. If `cclemons` manages other JumpCloud users, those user's will have their manager field set to null. Note. This command as the same effect as running `Remove-JCUser cclemons -Force`

### Example 4
```powershell
PS C:\> Remove-JCUser cclemons -CascadeManager automatic
```

Removes the JumpCloud user with the username 'cclemons' and automatically update's their subordinates manager field to `cclemons` manager. Ex. If `cclemons` is a manager and is also managed by another user with username: `some.manager`, the users managed by `cclemons` will be reassigned to `some.manager` upon `cclemons` removal. If `cclemons` is not managed by anyone, the manager field for the `cclemons` subordinates will be set to null.

### Example 5
```powershell
PS C:\> Remove-JCUser cclemons -CascadeManager User -CascadeManagerUser some.manager
```

Removes the JumpCloud user with the username `cclemons`. If `cclemons` is a manager, their subordinates will be reassigned to the manager specified by the provided username/id with CascadeManagerUser parameter. In this case, `cclemons` subordinates will be managed by the user with username: `some.manager` after `cclemons` is removed.

## PARAMETERS

@@ -59,6 +83,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -CascadeManager
A SwitchParameter for Cascading the manager of the user to the users managed by the user. NULL, AUTOMATIC (bubble up), ID (prompt for manager ID)
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: NULL, Automatic, User

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -force
A SwitchParameter which suppresses the warning message when removing a JumpCloud User.
111 changes: 56 additions & 55 deletions PowerShell/JumpCloud Module/JumpCloud.psd1
Original file line number Diff line number Diff line change
@@ -38,37 +38,38 @@ PowerShellVersion = '4.0'
# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''
# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('JumpCloud.SDK.DirectoryInsights',
'JumpCloud.SDK.V1',
'JumpCloud.SDK.V2')

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-JCAssociation', 'Add-JCCommandTarget', 'Add-JCGsuiteMember',
@@ -108,62 +109,62 @@ FunctionsToExport = 'Add-JCAssociation', 'Add-JCCommandTarget', 'Add-JCGsuiteMem
'Set-JCUserGroupLDAP', 'Update-JCDeviceFromCSV', 'Update-JCModule',
'Update-JCMSPFromCSV', 'Update-JCUsersFromCSV'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'
# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = 'New-JCAssociation'
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = 'New-JCAssociation'

# DSC resources to export from this module
# DscResourcesToExport = @()
# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()
# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()
# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'JumpCloud', 'DaaS', 'Jump', 'Cloud', 'Directory'
# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'JumpCloud', 'DaaS', 'Jump', 'Cloud', 'Directory'

# A URL to the license for this module.
LicenseUri = 'https://github.com/TheJumpCloud/support/blob/master/PowerShell/LICENSE'
# A URL to the license for this module.
LicenseUri = 'https://github.com/TheJumpCloud/support/blob/master/PowerShell/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/TheJumpCloud/support/wiki'
# A URL to the main website for this project.
ProjectUri = 'https://github.com/TheJumpCloud/support/wiki'

# A URL to an icon representing this module.
IconUri = 'https://avatars1.githubusercontent.com/u/4927461?s=200&v=4'
# A URL to an icon representing this module.
IconUri = 'https://avatars1.githubusercontent.com/u/4927461?s=200&v=4'

# ReleaseNotes of this module
ReleaseNotes = 'https://git.io/jc-pwsh-releasenotes'
# ReleaseNotes of this module
ReleaseNotes = 'https://git.io/jc-pwsh-releasenotes'

# Prerelease string of this module
# Prerelease = ''
# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()
# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable
} # End of PSData hashtable

} # End of PrivateData hashtable
} # End of PrivateData hashtable

# HelpInfo URI of this module
HelpInfoURI = 'https://github.com/TheJumpCloud/support/wiki'
# HelpInfo URI of this module
HelpInfoURI = 'https://github.com/TheJumpCloud/support/wiki'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

Loading

0 comments on commit 3286ca6

Please sign in to comment.