1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +02:00

Tidy up draft permission handling

Removes inconsistency of approvals vs. lifecycle.
This commit is contained in:
sauls8t 2019-06-11 10:38:39 +01:00
parent 2a45c82b46
commit a710839f69
2 changed files with 4 additions and 14 deletions

View file

@ -147,19 +147,9 @@ func (h *Handler) BySpace(w http.ResponseWriter, r *http.Request) {
return return
} }
// Get the space as we need to check settings.
space, err := h.Store.Space.Get(ctx, spaceID)
// Can user view drafts? // Can user view drafts?
viewDrafts := permission.CanViewDrafts(ctx, *h.Store, spaceID) 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 // Get complete list of documents regardless of category permission
// and versioning. // and versioning.
documents, err := h.Store.Document.GetBySpace(ctx, spaceID) documents, err := h.Store.Document.GetBySpace(ctx, spaceID)

View file

@ -46,9 +46,9 @@
<div class="perm-name">Templates</div> <div class="perm-name">Templates</div>
<div class="perm-desc">Can create and publish document templates</div> <div class="perm-desc">Can create and publish document templates</div>
<div class="perm-name">Approval</div> <div class="perm-name">Approval</div>
<div class="perm-desc">Can approve or reject document content changes</div> <div class="perm-desc">Can approve or reject document content changes, move drafts to live.</div>
<div class="perm-name">Lifecycle</div> <div class="perm-name">Drafts</div>
<div class="perm-desc">Can mark documents as Draft, Live and Archived</div> <div class="perm-desc">Can view and work on documents marked as draft</div>
<div class="perm-name">Versions</div> <div class="perm-name">Versions</div>
<div class="perm-desc">Can create document version and link them together</div> <div class="perm-desc">Can create document version and link them together</div>
</div> </div>
@ -89,7 +89,7 @@
<th class="text-info">Copy</th> <th class="text-info">Copy</th>
<th class="text-info">Templates</th> <th class="text-info">Templates</th>
<th class="text-info">Approval</th> <th class="text-info">Approval</th>
<th class="text-info">Lifecycle</th> <th class="text-info">Drafts</th>
<th class="text-info">Versions</th> <th class="text-info">Versions</th>
</tr> </tr>
</thead> </thead>