From be97a1be587f42a4688825244b025b06172c442a Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 25 Sep 2023 15:57:59 +0200 Subject: [PATCH] fix some templates --- quotas.go | 4 ++-- templates/garage_key.html | 20 ++++++++++---------- templates/garage_website_list.html | 2 +- templates/home.html | 6 +++--- templates/profile.html | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/quotas.go b/quotas.go index e077ac8..3eec9b8 100644 --- a/quotas.go +++ b/quotas.go @@ -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 } diff --git a/templates/garage_key.html b/templates/garage_key.html index b839fcb..e1a9019 100644 --- a/templates/garage_key.html +++ b/templates/garage_key.html @@ -21,12 +21,12 @@ - - + + - + @@ -58,12 +58,12 @@ -
+

Créez un fichier nommé ~/.awsrc :

-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
                         

Et ensuite pour utiliser Minio CLI avec :

@@ -176,7 +176,7 @@ hugo deploy
- + @@ -207,7 +207,7 @@ hugo deploy

Un exemple avec SCP :

-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/
                         
diff --git a/templates/garage_website_list.html b/templates/garage_website_list.html index ded8096..0f4a3b3 100644 --- a/templates/garage_website_list.html +++ b/templates/garage_website_list.html @@ -15,7 +15,7 @@ - {{ range $buck := .Key.Buckets }} + {{ range $buck := .S3KeyInfo.Buckets }} {{ if $buck.GlobalAliases }}
Identifiant de clé{{ .Key.AccessKeyId }}Identifiant de clé{{ .S3KeyInfo.AccessKeyId }}
Clé secrète{{ .Key.SecretAccessKey }}Cliquer pour afficher la clé secrète
Région
Nom d'utilisateur-ice{{ .Status.Info.Username }}{{ .Login.Info.Username }}
Mot de passe URLs
diff --git a/templates/home.html b/templates/home.html index 241a59d..3dad6b6 100644 --- a/templates/home.html +++ b/templates/home.html @@ -2,7 +2,7 @@ {{define "body"}}
- Bienvenue, {{ .Login.WelcomeName }} ! + Bienvenue, {{ .User.WelcomeName }} !
Se déconnecter @@ -33,7 +33,7 @@
-{{if .Login.CanInvite}} +{{if .User.Capabilities.CanInvite}}
Inviter des gens sur Deuxfleurs @@ -45,7 +45,7 @@
{{end}} -{{if .Login.CanAdmin}} +{{if .User.Capabilities.CanAdmin}}
Administration diff --git a/templates/profile.html b/templates/profile.html index 56461eb..17965a6 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -20,7 +20,7 @@
- +