aboutsummaryrefslogtreecommitdiff
path: root/login.go
diff options
context:
space:
mode:
Diffstat (limited to 'login.go')
-rw-r--r--login.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/login.go b/login.go
index 277e3ae..a2c7d8f 100644
--- a/login.go
+++ b/login.go
@@ -143,6 +143,7 @@ func NewCapabilities(login *LoginStatus, entry *ldap.Entry) *Capabilities {
// --- Logged User ---
type LoggedUser struct {
+ Username string
Login *LoginStatus
Entry *ldap.Entry
Capabilities *Capabilities
@@ -186,7 +187,9 @@ func NewLoggedUser(login *LoginStatus) (*LoggedUser, error) {
}
entry := sr.Entries[0]
+ username := login.Info.Username
lu := &LoggedUser{
+ Username: username,
Login: login,
Entry: entry,
Capabilities: NewCapabilities(login, entry),
@@ -204,6 +207,7 @@ func (lu *LoggedUser) WelcomeName() string {
}
return ret
}
+
func (lu *LoggedUser) S3KeyInfo() (*garage.KeyInfo, error) {
var err error
var keyPair *garage.KeyInfo
@@ -212,7 +216,7 @@ func (lu *LoggedUser) S3KeyInfo() (*garage.KeyInfo, error) {
keyID := lu.Entry.GetAttributeValue("garage_s3_access_key")
if keyID == "" {
// If there is no S3Key in LDAP, generate it...
- keyPair, err = grgCreateKey(lu.Login.Info.Username)
+ keyPair, err = grgCreateKey(lu.Username)
if err != nil {
return nil, err
}
@@ -221,7 +225,7 @@ func (lu *LoggedUser) S3KeyInfo() (*garage.KeyInfo, error) {
// @FIXME compatibility feature for bagage (SFTP+webdav)
// you can remove it once bagage will be updated to fetch the key from garage directly
// or when bottin will be able to dynamically fetch it.
- modify_request.Replace("garage_s3_secret_key", []string{*keyPair.SecretAccessKey})
+ modify_request.Replace("garage_s3_secret_key", []string{*keyPair.SecretAccessKey.Get()})
err = lu.Login.conn.Modify(modify_request)
if err != nil {
return nil, err