ubuntu resolute
This commit is contained in:
40
PS1/getperm.ps1
Normal file
40
PS1/getperm.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
# --- Paramètres personnalisables ---
|
||||
$repoName = "REPONAME" # Remplace par le nom du dépôt SVN
|
||||
$apiKey = "TOKEN" # Clé API
|
||||
$hostUrl = "https://localhost:8445" # URL de base de l'API
|
||||
|
||||
# --- Construction de l'URL complète avec paramètre GET ---
|
||||
$apiUrl = "$hostUrl/action/getperm?repo=$([uri]::EscapeDataString($repoName))"
|
||||
|
||||
# --- Ignorer les erreurs SSL (certificat auto-signé) ---
|
||||
Add-Type @"
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
public bool CheckValidationResult(
|
||||
ServicePoint srvPoint, X509Certificate certificate,
|
||||
WebRequest request, int certificateProblem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
"@
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
# --- Appel de l'API ---
|
||||
try {
|
||||
$headers = @{ "x-api-key" = $apiKey }
|
||||
|
||||
# Envoi de la requête GET
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers $headers
|
||||
|
||||
# Affichage formaté de la réponse
|
||||
Write-Host "`n--- Utilisateurs et Permissions pour '$repoName' ---"
|
||||
for ($i = 0; $i -lt $response.users.Count; $i++) {
|
||||
Write-Host "$($response.users[$i]) => $($response.permissions[$i])"
|
||||
}
|
||||
|
||||
Write-Host "`nTotal: $($response.count) utilisateur(s)"
|
||||
}
|
||||
catch {
|
||||
Write-Error "Erreur lors de l'appel à l'API : $($_.Exception.Message)"
|
||||
}
|
||||
Reference in New Issue
Block a user