An API for Guichet #23

Merged
quentin merged 14 commits from api into main 2023-09-26 06:44:36 +00:00
5 changed files with 17 additions and 17 deletions
Showing only changes of commit be97a1be58 - Show all commits

View file

@ -58,11 +58,11 @@ func entryToQuota(entry *ldap.Entry, field string) (int64, error) {
func NewUserQuotaFromEntry(entry *ldap.Entry) *UserQuota {
quotas := NewUserQuota()
if q, err := entryToQuota(entry, FIELD_QUOTA_WEBSITE_COUNT); err != nil {
if q, err := entryToQuota(entry, FIELD_QUOTA_WEBSITE_COUNT); err == nil {
quotas.WebsiteCount = q
}
if q, err := entryToQuota(entry, FIELD_QUOTA_WEBSITE_SIZE_BURSTED); err != nil {
if q, err := entryToQuota(entry, FIELD_QUOTA_WEBSITE_SIZE_BURSTED); err == nil {
quotas.WebsiteSizeBursted = q
}

View file

@ -21,12 +21,12 @@
<table class="table mt-4">
<tbody>
<tr>
<th scope="row">Identifiant de clé</th>
<td>{{ .Key.AccessKeyId }}</td>
<th scope="row" class="col-md-2">Identifiant de clé</th>
<td>{{ .S3KeyInfo.AccessKeyId }}</td>
</tr>
<tr>
<th scope="row">Clé secrète</th>
<td>{{ .Key.SecretAccessKey }}</td>
<td><a href="#" onclick="document.getElementById('secret_key').style.display='inline'; this.style.display='none'">Cliquer pour afficher la clé secrète</a><span id="secret_key" style="display: none">{{ .S3KeyInfo.SecretAccessKey }}</span></td>
</tr>
<tr>
<th scope="row">Région</th>
@ -58,12 +58,12 @@
</button>
</h2>
</div>
<div id="awscli" class="collapse show" aria-labelledby="awscli-title" data-parent="#softconfig">
<div id="awscli" class="collapse" aria-labelledby="awscli-title" data-parent="#softconfig">
<div class="card-body">
<p>Créez un fichier nommé <code>~/.awsrc</code> :</p>
<pre>
export AWS_ACCESS_KEY_ID={{ .Key.AccessKeyId }}
export AWS_SECRET_ACCESS_KEY={{ .Key.SecretAccessKey }}
export AWS_ACCESS_KEY_ID={{ .S3KeyInfo.AccessKeyId }}
export AWS_SECRET_ACCESS_KEY={{ .S3KeyInfo.SecretAccessKey }}
export AWS_DEFAULT_REGION='garage'
function aws { command aws --endpoint-url https://garage.deuxfleurs.fr $@ ; }
@ -97,8 +97,8 @@ aws s3 cp /tmp/a.txt s3://my-bucket
mc alias set \
garage \
https://garage.deuxfleurs.fr \
{{ .Key.AccessKeyId }} \
{{ .Key.SecretAccessKey }} \
{{ .S3KeyInfo.AccessKeyId }} \
{{ .S3KeyInfo.SecretAccessKey }} \
--api S3v4
</pre>
<p>Et ensuite pour utiliser Minio CLI avec :</p>
@ -176,7 +176,7 @@ hugo deploy
<tbody>
<tr>
<th scope="row">Nom d'utilisateur-ice</th>
<td>{{ .Status.Info.Username }}</td>
<td>{{ .Login.Info.Username }}</td>
</tr>
<tr>
<th scope="row">Mot de passe</th>
@ -207,7 +207,7 @@ hugo deploy
<div class="card-body">
<p>Un exemple avec SCP :</p>
<pre>
scp -oHostKeyAlgorithms=+ssh-rsa -P2222 -r ./public {{ .Status.Info.Username }}@bagage.deuxfleurs.fr:mon_bucket/
scp -oHostKeyAlgorithms=+ssh-rsa -P2222 -r ./public {{ .Login.Info.Username }}@bagage.deuxfleurs.fr:mon_bucket/
</pre>
</div>
</div>

View file

@ -15,7 +15,7 @@
<th scope="col">URLs</th>
</thead>
<tbody>
{{ range $buck := .Key.Buckets }}
{{ range $buck := .S3KeyInfo.Buckets }}
{{ if $buck.GlobalAliases }}
<tr>
<td>

View file

@ -2,7 +2,7 @@
{{define "body"}}
<div class="alert alert-info">
Bienvenue, <strong>{{ .Login.WelcomeName }}</strong> !
Bienvenue, <strong>{{ .User.WelcomeName }}</strong> !
</div>
<div class="d-flex">
<a class="ml-auto btn btn-sm btn-dark" href="/logout">Se déconnecter</a>
@ -33,7 +33,7 @@
</div>
</div>
{{if .Login.CanInvite}}
{{if .User.Capabilities.CanInvite}}
<div class="card mt-3">
<div class="card-header">
Inviter des gens sur Deuxfleurs
@ -45,7 +45,7 @@
</div>
{{end}}
{{if .Login.CanAdmin}}
{{if .User.Capabilities.CanAdmin}}
<div class="card mt-3">
<div class="card-header">
Administration

View file

@ -20,7 +20,7 @@
<div class="form-row">
<div class="form-group col-md-6">
<label>Identifiant:</label>
<input type="text" disabled="true" class="form-control" value="{{ .Status.Info.Username }}" />
<input type="text" disabled="true" class="form-control" value="{{ .User.Login.Info.Username }}" />
</div>
<div class="form-group col-md-6">
<label for="mail">Adresse e-mail:</label>