An API for Guichet #23
5 changed files with 17 additions and 17 deletions
|
@ -58,11 +58,11 @@ func entryToQuota(entry *ldap.Entry, field string) (int64, error) {
|
||||||
func NewUserQuotaFromEntry(entry *ldap.Entry) *UserQuota {
|
func NewUserQuotaFromEntry(entry *ldap.Entry) *UserQuota {
|
||||||
quotas := NewUserQuota()
|
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
|
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
|
quotas.WebsiteSizeBursted = q
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
<table class="table mt-4">
|
<table class="table mt-4">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Identifiant de clé</th>
|
<th scope="row" class="col-md-2">Identifiant de clé</th>
|
||||||
<td>{{ .Key.AccessKeyId }}</td>
|
<td>{{ .S3KeyInfo.AccessKeyId }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Clé secrète</th>
|
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Région</th>
|
<th scope="row">Région</th>
|
||||||
|
@ -58,12 +58,12 @@
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</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">
|
<div class="card-body">
|
||||||
<p>Créez un fichier nommé <code>~/.awsrc</code> :</p>
|
<p>Créez un fichier nommé <code>~/.awsrc</code> :</p>
|
||||||
<pre>
|
<pre>
|
||||||
export AWS_ACCESS_KEY_ID={{ .Key.AccessKeyId }}
|
export AWS_ACCESS_KEY_ID={{ .S3KeyInfo.AccessKeyId }}
|
||||||
export AWS_SECRET_ACCESS_KEY={{ .Key.SecretAccessKey }}
|
export AWS_SECRET_ACCESS_KEY={{ .S3KeyInfo.SecretAccessKey }}
|
||||||
export AWS_DEFAULT_REGION='garage'
|
export AWS_DEFAULT_REGION='garage'
|
||||||
|
|
||||||
function aws { command aws --endpoint-url https://garage.deuxfleurs.fr $@ ; }
|
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 \
|
mc alias set \
|
||||||
garage \
|
garage \
|
||||||
https://garage.deuxfleurs.fr \
|
https://garage.deuxfleurs.fr \
|
||||||
{{ .Key.AccessKeyId }} \
|
{{ .S3KeyInfo.AccessKeyId }} \
|
||||||
{{ .Key.SecretAccessKey }} \
|
{{ .S3KeyInfo.SecretAccessKey }} \
|
||||||
--api S3v4
|
--api S3v4
|
||||||
</pre>
|
</pre>
|
||||||
<p>Et ensuite pour utiliser Minio CLI avec :</p>
|
<p>Et ensuite pour utiliser Minio CLI avec :</p>
|
||||||
|
@ -176,7 +176,7 @@ hugo deploy
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Nom d'utilisateur-ice</th>
|
<th scope="row">Nom d'utilisateur-ice</th>
|
||||||
<td>{{ .Status.Info.Username }}</td>
|
<td>{{ .Login.Info.Username }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Mot de passe</th>
|
<th scope="row">Mot de passe</th>
|
||||||
|
@ -207,7 +207,7 @@ hugo deploy
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>Un exemple avec SCP :</p>
|
<p>Un exemple avec SCP :</p>
|
||||||
<pre>
|
<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>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<th scope="col">URLs</th>
|
<th scope="col">URLs</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{ range $buck := .Key.Buckets }}
|
{{ range $buck := .S3KeyInfo.Buckets }}
|
||||||
{{ if $buck.GlobalAliases }}
|
{{ if $buck.GlobalAliases }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
Bienvenue, <strong>{{ .Login.WelcomeName }}</strong> !
|
Bienvenue, <strong>{{ .User.WelcomeName }}</strong> !
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<a class="ml-auto btn btn-sm btn-dark" href="/logout">Se déconnecter</a>
|
<a class="ml-auto btn btn-sm btn-dark" href="/logout">Se déconnecter</a>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .Login.CanInvite}}
|
{{if .User.Capabilities.CanInvite}}
|
||||||
<div class="card mt-3">
|
<div class="card mt-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Inviter des gens sur Deuxfleurs
|
Inviter des gens sur Deuxfleurs
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .Login.CanAdmin}}
|
{{if .User.Capabilities.CanAdmin}}
|
||||||
<div class="card mt-3">
|
<div class="card mt-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Administration
|
Administration
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label>Identifiant:</label>
|
<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>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mail">Adresse e-mail:</label>
|
<label for="mail">Adresse e-mail:</label>
|
||||||
|
|
Loading…
Reference in a new issue