@@ -3,7 +3,6 @@ package filestore
3
3
import (
4
4
"context"
5
5
"errors"
6
- "fmt"
7
6
"io"
8
7
"net/http"
9
8
@@ -21,7 +20,7 @@ func (m *Module) CreateDir(ctx context.Context, project, token string, req *mode
21
20
// Check if the user is authorised to make this request
22
21
_ , err := m .auth .IsFileOpAuthorised (ctx , project , token , req .Path , utils .FileCreate , map [string ]interface {}{})
23
22
if err != nil {
24
- return http .StatusForbidden , errors . New ( "You are not authorized to make this request" )
23
+ return http .StatusForbidden , err
25
24
}
26
25
27
26
m .RLock ()
@@ -52,7 +51,7 @@ func (m *Module) DeleteFile(ctx context.Context, project, token string, path str
52
51
// Check if the user is authorised to make this request
53
52
_ , err := m .auth .IsFileOpAuthorised (ctx , project , token , path , utils .FileDelete , map [string ]interface {}{})
54
53
if err != nil {
55
- return http .StatusForbidden , errors . New ( "You are not authorized to make this request" )
54
+ return http .StatusForbidden , err
56
55
}
57
56
58
57
m .RLock ()
@@ -83,7 +82,7 @@ func (m *Module) ListFiles(ctx context.Context, project, token string, req *mode
83
82
// Check if the user is authorised to make this request
84
83
_ , err := m .auth .IsFileOpAuthorised (ctx , project , token , req .Path , utils .FileRead , map [string ]interface {}{})
85
84
if err != nil {
86
- return http .StatusForbidden , nil , fmt . Errorf ( "You are not authorized to make this request - %v" , err )
85
+ return http .StatusForbidden , nil , err
87
86
}
88
87
89
88
m .RLock ()
@@ -106,9 +105,9 @@ func (m *Module) UploadFile(ctx context.Context, project, token string, req *mod
106
105
}
107
106
108
107
// Check if the user is authorised to make this request
109
- _ , err := m .auth .IsFileOpAuthorised (ctx , project , token , req .Path , utils .FileCreate , map [string ]interface {}{})
108
+ _ , err := m .auth .IsFileOpAuthorised (ctx , project , token , req .Path , utils .FileCreate , map [string ]interface {}{"meta" : req . Meta })
110
109
if err != nil {
111
- return http .StatusForbidden , errors . New ( "You are not authorized to make this request" )
110
+ return http .StatusForbidden , err
112
111
}
113
112
114
113
m .RLock ()
@@ -139,7 +138,7 @@ func (m *Module) DownloadFile(ctx context.Context, project, token, path string)
139
138
// Check if the user is authorised to make this request
140
139
_ , err := m .auth .IsFileOpAuthorised (ctx , project , token , path , utils .FileRead , map [string ]interface {}{})
141
140
if err != nil {
142
- return http .StatusForbidden , nil , errors . New ( "You are not authorized to make this request" )
141
+ return http .StatusForbidden , nil , err
143
142
}
144
143
145
144
m .RLock ()
@@ -165,7 +164,7 @@ func (m *Module) DoesExists(ctx context.Context, project, token, path string) er
165
164
// Check if the user is authorised to make this request
166
165
_ , err := m .auth .IsFileOpAuthorised (ctx , project , token , path , utils .FileRead , map [string ]interface {}{})
167
166
if err != nil {
168
- return errors . New ( "You are not authorized to make this request" )
167
+ return err
169
168
}
170
169
171
170
m .RLock ()
0 commit comments