diff options
author | Quentin <quentin@dufour.io> | 2024-06-24 10:15:56 +0000 |
---|---|---|
committer | Quentin <quentin@dufour.io> | 2024-06-24 10:15:56 +0000 |
commit | 9917429da3b06462969b41d511ad4daf27eaf197 (patch) | |
tree | 1a27c40a1ff9123b5552769fcf3cbb543d8dc959 /login.go | |
parent | e7e05ed929c92c2b9d193f8193878c1a8a74c43c (diff) | |
parent | bc7bc61f7449b1f41ed9eb46388ab0c149856f96 (diff) | |
download | guichet-main.tar.gz guichet-main.zip |
Merge pull request 'per-bucket keys' (#68) from feat-per-bucket-key into mainmain
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/guichet/pulls/68
Diffstat (limited to 'login.go')
-rw-r--r-- | login.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |