Prevent isCommentOnly user adding attachments, editing list names, moving lists,

and seeing board settings menu. Show non-editable Custom Fields to isCommentOnly user.

Thanks to xet7 !

Closes wekan/wekan-snap#97,
closes #2416,
closes #2255
This commit is contained in:
Lauri Ojansivu 2019-07-24 15:01:05 +03:00
parent 62bfe1da21
commit a68c928896
5 changed files with 42 additions and 19 deletions

View file

@ -37,6 +37,7 @@ template(name="attachmentsGalery")
i.fa.fa-download i.fa.fa-download
| {{_ 'download'}} | {{_ 'download'}}
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
if isImage if isImage
a(class="{{#if $eq ../coverId _id}}js-remove-cover{{else}}js-add-cover{{/if}}") a(class="{{#if $eq ../coverId _id}}js-remove-cover{{else}}js-add-cover{{/if}}")
i.fa.fa-thumb-tack i.fa.fa-thumb-tack
@ -49,5 +50,6 @@ template(name="attachmentsGalery")
| {{_ 'delete'}} | {{_ 'delete'}}
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
li.attachment-item.add-attachment li.attachment-item.add-attachment
a.js-add-attachment {{_ 'add-attachment' }} a.js-add-attachment {{_ 'add-attachment' }}

View file

@ -31,6 +31,10 @@ template(name="cardCustomField-text")
= value = value
else else
| {{_ 'edit'}} | {{_ 'edit'}}
else
+viewer
= value
template(name="cardCustomField-number") template(name="cardCustomField-number")
if canModifyCard if canModifyCard
@ -45,6 +49,9 @@ template(name="cardCustomField-number")
= value = value
else else
| {{_ 'edit'}} | {{_ 'edit'}}
else
if value
= value
template(name="cardCustomField-date") template(name="cardCustomField-date")
if canModifyCard if canModifyCard
@ -55,6 +62,11 @@ template(name="cardCustomField-date")
| {{showDate}} | {{showDate}}
else else
| {{_ 'edit'}} | {{_ 'edit'}}
else
if value
div.card-date
time(datetime="{{showISODate}}")
| {{showDate}}
template(name="cardCustomField-dropdown") template(name="cardCustomField-dropdown")
if canModifyCard if canModifyCard
@ -79,3 +91,7 @@ template(name="cardCustomField-dropdown")
= selectedItem = selectedItem
else else
| {{_ 'edit'}} | {{_ 'edit'}}
else
if value
+viewer
= selectedItem

View file

@ -9,7 +9,7 @@ template(name="listHeader")
if currentList if currentList
a.list-header-left-icon.fa.fa-angle-left.js-unselect-list a.list-header-left-icon.fa.fa-angle-left.js-unselect-list
h2.list-header-name( h2.list-header-name(
class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}") class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}js-open-inlined-form is-editable{{/unless}}{{/if}}")
+viewer +viewer
= title = title
if wipLimit.enabled if wipLimit.enabled

View file

@ -34,6 +34,7 @@ template(name="membersWidget")
h3 h3
i.fa.fa-user i.fa.fa-user
| {{_ 'members'}} | {{_ 'members'}}
unless currentUser.isCommentOnly
a.board-header-btn.js-open-board-menu(title="{{_ 'boardMenuPopup-title'}}").right a.board-header-btn.js-open-board-menu(title="{{_ 'boardMenuPopup-title'}}").right
i.board-header-btn-icon.fa.fa-cog i.board-header-btn-icon.fa.fa-cog

View file

@ -9,6 +9,7 @@ template(name="swimlane")
each lists each lists
+miniList(this) +miniList(this)
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
+addListForm +addListForm
else else
each lists each lists
@ -16,6 +17,7 @@ template(name="swimlane")
if currentCardIsInThisList _id ../_id if currentCardIsInThisList _id ../_id
+cardDetails(currentCard) +cardDetails(currentCard)
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
+addListForm +addListForm
template(name="listsGroup") template(name="listsGroup")
@ -27,6 +29,7 @@ template(name="listsGroup")
each lists each lists
+miniList(this) +miniList(this)
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
+addListForm +addListForm
else else
each lists each lists
@ -34,6 +37,7 @@ template(name="listsGroup")
if currentCardIsInThisList _id null if currentCardIsInThisList _id null
+cardDetails(currentCard) +cardDetails(currentCard)
if currentUser.isBoardMember if currentUser.isBoardMember
unless currentUser.isCommentOnly
+addListForm +addListForm
template(name="addListForm") template(name="addListForm")