forked from FabLabMons/iotlab-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
François ROLAND
committed
Jul 17, 2018
1 parent
a2f7cca
commit 9fcc834
Showing
5 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
*.iml | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
if ($args.Count -ne 1) | ||
{ | ||
Write-Host 'Wrong argument count' | ||
Write-Host 'usage: .\create-training-user-set.PS1 <gateway_ip>' | ||
exit | ||
} | ||
|
||
$Gateway = $args[0] | ||
$UserCount = 12 | ||
Write-Host "Creating $($UserCount) users on IoT-Lab gateway $($Gateway)" | ||
|
||
for ($i = 1; $i -lt $($UserCount + 1); $i++) { | ||
.\create-user.PS1 $($Gateway) "training$($i)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
if ($args.Count -ne 1) | ||
{ | ||
Write-Host 'Wrong argument count' | ||
Write-Host 'usage: .\cleanup-training-user-set.PS1 <gateway_ip>' | ||
exit | ||
} | ||
|
||
$Gateway = $args[0] | ||
$UserCount = 12 | ||
Write-Host "Cleaning up $($UserCount) users on IoT-Lab gateway $($Gateway)" | ||
|
||
for ($i = 1; $i -lt $($UserCount + 1); $i++) { | ||
.\remove-user.PS1 $($Gateway) "training$($i)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
if ($args.Count -ne 2) | ||
{ | ||
Write-Host 'Wrong argument count' | ||
Write-Host 'usage: .\remove-user.PS1 <gateway_ip> <new_username>' | ||
exit | ||
} | ||
|
||
$Gateway = $args[0] | ||
$UserToDelete = $args[1] | ||
Write-Host "Removing user $($UserToDelete) from IoT-Lab gateway $($Gateway)" | ||
|
||
Write-Host ' - Grafana' | ||
|
||
http -o remove-user.log -a admin:admin POST "$($Gateway)/grafana/api/user/using/1" | ||
|
||
Write-Host ' Remove User' | ||
$UserId = $(http -a admin:admin GET "$($Gateway)/grafana/api/users/lookup" "loginOrEmail==$($UserToDelete)" | ConvertFrom-Json).id | ||
http -o remove-user.log -a admin:admin DELETE "$($Gateway)/grafana/api/admin/users/$($UserId)" | ||
Write-Host ' Remove organisation' | ||
$OrganisationId = $(http -a admin:admin -b GET "$($Gateway)/grafana/api/orgs/name/$($UserToDelete)" | ConvertFrom-Json).id | ||
http -o remove-user.log -a admin:admin DELETE "$($Gateway)/grafana/api/orgs/$($OrganisationId)" "name=$($UserToDelete)" | ||
|
||
Write-Host '' | ||
Write-Host ' - InfluxDB' | ||
http -o remove-user.log --form POST "$($Gateway):8086/query" q='DROP DATABASE "'$($UserToDelete)'"' | ||
|
||
Write-Host '' | ||
Write-Host "User $($UserToDelete) removed" | ||
Write-Host '' |