mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
Draft documents always visible to editors when space lifecycle set to Draft mode
This commit is contained in:
parent
9724f85653
commit
f5b196c334
6 changed files with 688 additions and 744 deletions
|
@ -143,9 +143,19 @@ func (h *Handler) BySpace(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// get user permissions
|
||||
// Get the space as we need to check settings.
|
||||
space, err := h.Store.Space.Get(ctx, spaceID)
|
||||
|
||||
// Can user view drafts?
|
||||
viewDrafts := permission.CanViewDrafts(ctx, *h.Store, spaceID)
|
||||
|
||||
// If space defaults to drfat documents, then this means
|
||||
// user can view drafts as long as they have edit rights.
|
||||
canEdit := permission.HasPermission(ctx, *h.Store, spaceID, pm.DocumentEdit)
|
||||
if space.Lifecycle == workflow.LifecycleDraft && canEdit {
|
||||
viewDrafts = true
|
||||
}
|
||||
|
||||
// Get complete list of documents regardless of category permission
|
||||
// and versioning.
|
||||
documents, err := h.Store.Document.GetBySpace(ctx, spaceID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue