Skip to content

Commit 3a9de08

Browse files
committed
Admin : Retrieve the metastore without the authentication test
Alow retrieval of a raw content from admin, even when the repository is not public.
1 parent 1c5f991 commit 3a9de08

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

meta_store.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ func (s *MetaStore) Get(v *RequestVars) (*MetaObject, error) {
5555
if !s.authenticate(v.Authorization) {
5656
return nil, newAuthError()
5757
}
58+
meta, error := s.UnsafeGet(v)
59+
return meta, error;
60+
}
5861

62+
// Get retrieves the Meta information for an object given information in
63+
// RequestVars
64+
// DO NOT CHECK authentication, as it is supposed to have been done before
65+
func (s *MetaStore) UnsafeGet(v *RequestVars) (*MetaObject, error) {
5966
var meta MetaObject
6067

6168
err := s.db.View(func(tx *bolt.Tx) error {

mgmt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (a *App) objectsRawHandler(w http.ResponseWriter, r *http.Request) {
101101
Authorization: r.Header.Get("Authorization"),
102102
}
103103

104-
meta, err := a.metaStore.Get(rv)
104+
meta, err := a.metaStore.UnsafeGet(rv)
105105
if err != nil {
106106
if isAuthError(err) {
107107
requireAuth(w, r)

0 commit comments

Comments
 (0)