mirror of
https://github.com/documize/community.git
synced 2025-07-24 23:59:47 +02:00
ember-truth-helpers, allow for no category viewers
This commit is contained in:
parent
3a9675eb14
commit
b56d3426d2
7 changed files with 20 additions and 12 deletions
|
@ -310,8 +310,7 @@ func (h *Handler) GetSummary(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
/*
|
||||
- category view permission handling
|
||||
- filter users using new permission
|
||||
- filter users using account.users = true/false
|
||||
- link/unlink document to category
|
||||
- check print/pdf
|
||||
- filter space documents by category -- URL param? nested route?
|
||||
|
|
|
@ -330,6 +330,12 @@ func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
spaceID := request.Query(r, "space")
|
||||
if len(id) == 0 {
|
||||
response.WriteMissingDataError(w, method, "space")
|
||||
return
|
||||
}
|
||||
|
||||
defer streamutil.Close(r.Body)
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
|
@ -346,12 +352,6 @@ func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
if len(model) == 0 {
|
||||
response.WriteEmpty(w)
|
||||
return
|
||||
}
|
||||
|
||||
spaceID := model[0].SpaceID
|
||||
if !HasPermission(ctx, *h.Store, spaceID, permission.SpaceManage, permission.SpaceOwner) {
|
||||
response.WriteForbiddenError(w)
|
||||
return
|
||||
|
|
|
@ -182,6 +182,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, DropdownMixin
|
|||
},
|
||||
|
||||
onGrantAccess() {
|
||||
let folder = this.get('folder');
|
||||
let category = this.get('currentCategory');
|
||||
let users = this.get('categoryUsers').filterBy('selected', true);
|
||||
let viewers = [];
|
||||
|
@ -200,7 +201,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, DropdownMixin
|
|||
viewers.push(v);
|
||||
});
|
||||
|
||||
this.get('categoryService').setViewers(category.get('id'), viewers).then(() => {
|
||||
this.get('categoryService').setViewers(folder.get('id'), category.get('id'), viewers).then(() => {
|
||||
this.load();
|
||||
});
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ export default BaseService.extend({
|
|||
},
|
||||
|
||||
// Save list of users who can see given category
|
||||
setViewers(categoryId, viewers) {
|
||||
return this.get('ajax').request(`category/${categoryId}/permission`, {
|
||||
setViewers(spaceId, categoryId, viewers) {
|
||||
return this.get('ajax').request(`category/${categoryId}/permission?space=${spaceId}`, {
|
||||
method: 'PUT',
|
||||
contentType: 'json',
|
||||
data: JSON.stringify(viewers)
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
{{else}}
|
||||
<div class="category">
|
||||
<div class="name">{{cat.category}}</div>
|
||||
<div class="info">{{cat.documents}} documents, {{cat.users}} people</div>
|
||||
<div class="info">
|
||||
{{cat.documents}} {{if (eq cat.documents 1) 'document' 'documents' }}, {{cat.users}} {{if (eq cat.users 1) 'person' 'people' }}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="pull-right buttons">
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"ember-resolver": "^4.0.0",
|
||||
"ember-simple-auth": "1.2.2",
|
||||
"ember-source": "~2.15.0",
|
||||
"ember-truth-helpers": "^1.3.0",
|
||||
"loader.js": "^4.2.3"
|
||||
},
|
||||
"ember-addon": {
|
||||
|
|
|
@ -2663,6 +2663,12 @@ ember-test-helpers@^0.6.3:
|
|||
version "0.6.3"
|
||||
resolved "https://registry.yarnpkg.com/ember-test-helpers/-/ember-test-helpers-0.6.3.tgz#f864cdf6f4e75f3f8768d6537785b5ab6e82d907"
|
||||
|
||||
ember-truth-helpers@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ember-truth-helpers/-/ember-truth-helpers-1.3.0.tgz#6ed9f83ce9a49f52bb416d55e227426339a64c60"
|
||||
dependencies:
|
||||
ember-cli-babel "^5.1.6"
|
||||
|
||||
ember-try-config@^2.0.1:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ember-try-config/-/ember-try-config-2.1.0.tgz#e0e156229a542346a58ee6f6ad605104c98edfe0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue