1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 23:59:47 +02:00

Fix space permissions group vs. user role overriding

This commit is contained in:
sauls8t 2018-03-27 11:33:43 +01:00
parent e1d2d4c037
commit ad4030bc17
11 changed files with 691 additions and 680 deletions

View file

@ -19,6 +19,7 @@ export default Component.extend(ModalMixin, {
groupSvc: service('group'),
spaceSvc: service('folder'),
userSvc: service('user'),
router: service(),
appMeta: service(),
store: service(),
spacePermissions: null,
@ -26,6 +27,8 @@ export default Component.extend(ModalMixin, {
searchText: '',
didReceiveAttrs() {
this._super(...arguments);
let spacePermissions = A([]);
let constants = this.get('constants');
@ -77,7 +80,6 @@ export default Component.extend(ModalMixin, {
permissionRecord(who, whoId, name) {
let raw = {
id: whoId,
orgId: this.get('folder.orgId'),
folderId: this.get('folder.id'),
whoId: whoId,
@ -161,6 +163,7 @@ export default Component.extend(ModalMixin, {
this.get('spaceSvc').savePermissions(folder.get('id'), payload).then(() => {
this.modalClose('#space-permission-modal');
this.get('onRefresh')();
});
},

View file

@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
if (is.not.null(this.get('dropzone'))) {
this.get('dropzone').destroy();
this.set('dropzone', null);
}
}
},
getDefaultInvitationMessage() {
@ -354,7 +354,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
let template = this.get('templates').findBy('id', id)
this.modalClose("#space-template-modal");
let slug = stringUtil.makeSlug(template.get('title'));
this.get('router').transitionTo('document', this.get('space.id'), this.get('space.slug'), id, slug);
}

View file

@ -2,9 +2,13 @@ import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
normalize(modelClass, resourceHash) {
let id = '0';
if (resourceHash.whoId) id = resourceHash.whoId;
if (resourceHash.id) id = resourceHash.id;
return {
data: {
id: resourceHash.whoId ? resourceHash.whoId : 0,
id: id,
type: modelClass.modelName,
attributes: resourceHash
}

View file

@ -122,6 +122,7 @@ export default BaseService.extend({
if (is.not.array(response)) response = [];
data = response.map((obj) => {
obj.id = 'sp-' + obj.id;
let data = this.get('store').normalize('space-permission', obj);
return this.get('store').push(data);
});
@ -165,6 +166,7 @@ export default BaseService.extend({
let url = `space/${folderId}/permissions/user`;
return this.get('ajax').request(url).then((response) => {
response.id = 'u-' + response.id;
let data = this.get('store').normalize('space-permission', response);
let data2 = this.get('store').push(data);
this.set('permissions', data2);

View file

@ -15,20 +15,20 @@
@top-right {
font-size: 12px;
content: string(doctitle);
color: $color-off-black;
// content: string(doctitle);
}
@bottom-left {
font-size: 12px;
content: 'Exported from Documize';
color: $color-off-black;
// content: 'Exported from Documize';
}
@bottom-right {
content: counter(page);
font-size: 12px;
color: $color-off-black;
// content: counter(page);
}
}

View file

@ -39,7 +39,7 @@
{{/unless}}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">

View file

@ -1,5 +1,5 @@
{{#toolbar/t-toolbar}}
{{#toolbar/t-links}}
{{#link-to "folders" class="link" tagName="li"}}Spaces{{/link-to}}
{{/toolbar/t-links}}
@ -189,7 +189,7 @@
<div class="import-zone">
<button id="import-document-button" type="button" class="btn btn-outline-secondary btn-lg btn-block">
<br/>
Click to select files or drag-drop files
Click to select files or drag-drop files
<br/><br/>
.doc, .docx, .md, .markdown
<br/><br/>
@ -206,10 +206,10 @@
</div>
</div>
</div>
</div>
</div>
{{/if}}
{{/toolbar/t-actions}}
{{/toolbar/t-toolbar}}
{{folder/permission-admin folders=spaces folder=space}}
{{folder/permission-admin folders=spaces folder=space onRefresh=onRefresh}}