1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 06:39:43 +02:00

changed indexer coupling

This commit is contained in:
Harvey Kandola 2017-08-02 15:58:39 +01:00
parent 562872a4a8
commit ecc94f31c9
12 changed files with 52 additions and 45 deletions

View file

@ -61,7 +61,7 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
return
}
if CanViewDocumentInFolder(ctx, *h.Store, document.LabelID) {
if !CanViewDocumentInFolder(ctx, *h.Store, document.LabelID) {
response.WriteForbiddenError(w)
return
}
@ -72,12 +72,16 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
return
}
h.Store.Activity.RecordUserActivity(ctx, activity.UserActivity{
err = h.Store.Activity.RecordUserActivity(ctx, activity.UserActivity{
LabelID: document.LabelID,
SourceID: document.RefID,
SourceType: activity.SourceTypeDocument,
ActivityType: activity.TypeRead})
if err != nil {
h.Runtime.Log.Error("record user activity", err)
}
h.Store.Audit.Record(ctx, audit.EventTypeDocumentView)
ctx.Transaction.Commit()
@ -143,6 +147,7 @@ func (h *Handler) BySpace(w http.ResponseWriter, r *http.Request) {
}
if !space.CanViewSpace(ctx, *h.Store, folderID) {
h.Runtime.Log.Info("no permission to view space documents")
response.WriteForbiddenError(w)
return
}