mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
Provider foundation for doc lifecycle and versions
This commit is contained in:
parent
4e32bffebe
commit
958f4d30b9
19 changed files with 918 additions and 782 deletions
|
@ -19,12 +19,12 @@ export default Component.extend(ModalMixin, {
|
|||
groupSvc: service('group'),
|
||||
spaceSvc: service('folder'),
|
||||
userSvc: service('user'),
|
||||
appMeta: service(),
|
||||
appMeta: service(),
|
||||
store: service(),
|
||||
spacePermissions: null,
|
||||
users: null,
|
||||
searchText: '',
|
||||
|
||||
|
||||
didReceiveAttrs() {
|
||||
let spacePermissions = A([]);
|
||||
let constants = this.get('constants');
|
||||
|
@ -65,7 +65,7 @@ export default Component.extend(ModalMixin, {
|
|||
// always show everyone
|
||||
if (!hasEveryoneId) {
|
||||
let pr = this.permissionRecord(constants.WhoType.User, constants.EveryoneUserId, ' ' + constants.EveryoneUserName);
|
||||
spacePermissions.pushObject(pr);
|
||||
spacePermissions.pushObject(pr);
|
||||
}
|
||||
|
||||
this.set('spacePermissions', spacePermissions.sortBy('who', 'name'));
|
||||
|
@ -93,6 +93,8 @@ export default Component.extend(ModalMixin, {
|
|||
documentCopy: false,
|
||||
documentTemplate: false,
|
||||
documentApprove: false,
|
||||
documentLifecycle: false,
|
||||
documentVersion: false,
|
||||
};
|
||||
|
||||
let rec = this.get('store').normalize('space-permission', raw);
|
||||
|
@ -132,7 +134,8 @@ export default Component.extend(ModalMixin, {
|
|||
let hasEveryone = _.find(permissions, (permission) => {
|
||||
return permission.get('whoId') === constants.EveryoneUserId &&
|
||||
(permission.get('spaceView') || permission.get('documentAdd') || permission.get('documentEdit') || permission.get('documentDelete') ||
|
||||
permission.get('documentMove') || permission.get('documentCopy') || permission.get('documentTemplate') || permission.get('documentApprove'));
|
||||
permission.get('documentMove') || permission.get('documentCopy') || permission.get('documentTemplate') ||
|
||||
permission.get('documentApprove') || permission.get('documentLifecycle') || permission.get('documentVersion'));
|
||||
});
|
||||
|
||||
// see if more than oen user is granted access to space (excluding everyone)
|
||||
|
@ -140,8 +143,9 @@ export default Component.extend(ModalMixin, {
|
|||
permissions.forEach((permission) => {
|
||||
if (permission.get('whoId') !== constants.EveryoneUserId &&
|
||||
(permission.get('spaceView') || permission.get('documentAdd') || permission.get('documentEdit') || permission.get('documentDelete') ||
|
||||
permission.get('documentMove') || permission.get('documentCopy') || permission.get('documentTemplate') || permission.get('documentApprove'))) {
|
||||
roleCount += 1;
|
||||
permission.get('documentMove') || permission.get('documentCopy') || permission.get('documentTemplate') ||
|
||||
permission.get('documentApprove') || permission.get('documentLifecycle') || permission.get('documentVersion'))) {
|
||||
roleCount += 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -161,7 +165,7 @@ export default Component.extend(ModalMixin, {
|
|||
},
|
||||
|
||||
onSearch() {
|
||||
debounce(this, function() {
|
||||
debounce(this, function () {
|
||||
let searchText = this.get('searchText').trim();
|
||||
|
||||
if (searchText.length === 0) {
|
||||
|
@ -181,7 +185,6 @@ export default Component.extend(ModalMixin, {
|
|||
if (is.undefined(exists)) {
|
||||
spacePermissions.pushObject(this.permissionRecord(constants.WhoType.User, user.get('id'), user.get('fullname')));
|
||||
this.set('spacePermissions', spacePermissions);
|
||||
// this.set('spacePermissions', spacePermissions.sortBy('who', 'name'));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ export default Model.extend({
|
|||
documentCopy: attr('boolean'),
|
||||
documentTemplate: attr('boolean'),
|
||||
documentApprove: attr('boolean'),
|
||||
documentLifecycle: attr('boolean'),
|
||||
documentVersion: attr('boolean'),
|
||||
name: attr('string'), // read-only
|
||||
members: attr('number') // read-only
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="modal-header">Space Permissions</div>
|
||||
<div class="modal-body" style="overflow-x: auto;">
|
||||
<div class="space-admin table-responsive">
|
||||
|
||||
|
||||
<table class="table table-hover permission-table mb-3">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -24,6 +24,8 @@
|
|||
<th class="text-info">Copy</th>
|
||||
<th class="text-info">Templates</th>
|
||||
<th class="text-info">Approval</th>
|
||||
<th class="text-info">Lifecycle</th>
|
||||
<th class="text-info">Versions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -38,53 +40,35 @@
|
|||
<small class="form-text text-muted d-inline-block">({{permission.members}})</small>
|
||||
</span>
|
||||
{{else}}
|
||||
{{#if (eq permission.whoId constants.EveryoneUserId)}}
|
||||
<span class="button-icon-green button-icon-small align-middle">
|
||||
<i class="material-icons">language</i>
|
||||
</span>
|
||||
<span class="color-green"> {{permission.name}}</span>
|
||||
{{else}}
|
||||
<span class="button-icon-gray button-icon-small align-middle">
|
||||
<i class="material-icons">person</i>
|
||||
</span>
|
||||
<span class=""> {{permission.name}}
|
||||
{{#if (eq permission.whoId session.user.id)}}
|
||||
<small class="form-text text-muted d-inline-block">(you)</small>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{#if (eq permission.whoId constants.EveryoneUserId)}}
|
||||
<span class="button-icon-green button-icon-small align-middle">
|
||||
<i class="material-icons">language</i>
|
||||
</span>
|
||||
<span class="color-green"> {{permission.name}}</span>
|
||||
{{else}}
|
||||
<span class="button-icon-gray button-icon-small align-middle">
|
||||
<i class="material-icons">person</i>
|
||||
</span>
|
||||
<span class=""> {{permission.name}}
|
||||
{{#if (eq permission.whoId session.user.id)}}
|
||||
<small class="form-text text-muted d-inline-block">(you)</small>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'space-role-view-' permission.whoId) checked=permission.spaceView}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'space-role-manage-' permission.whoId) checked=permission.spaceManage}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'space-role-owner-' permission.whoId) checked=permission.spaceOwner}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-add-' permission.whoId) checked=permission.documentAdd}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-edit-' permission.whoId) checked=permission.documentEdit}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-delete-' permission.whoId) checked=permission.documentDelete}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-move-' permission.whoId) checked=permission.documentMove}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-copy-' permission.whoId) checked=permission.documentCopy}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-template-' permission.whoId) checked=permission.documentTemplate}}
|
||||
</td>
|
||||
<td>
|
||||
{{input type="checkbox" id=(concat 'doc-role-approve-' permission.whoId) checked=permission.documentApprove}}
|
||||
</td>
|
||||
<td>{{input type="checkbox" id=(concat 'space-role-view-' permission.whoId) checked=permission.spaceView}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'space-role-manage-' permission.whoId) checked=permission.spaceManage}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'space-role-owner-' permission.whoId) checked=permission.spaceOwner}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-add-' permission.whoId) checked=permission.documentAdd}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-edit-' permission.whoId) checked=permission.documentEdit}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-delete-' permission.whoId) checked=permission.documentDelete}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-move-' permission.whoId) checked=permission.documentMove}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-copy-' permission.whoId) checked=permission.documentCopy}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-template-' permission.whoId) checked=permission.documentTemplate}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-approve-' permission.whoId) checked=permission.documentApprove}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-lifecycle-' permission.whoId) checked=permission.documentLifecycle}}</td>
|
||||
<td>{{input type="checkbox" id=(concat 'doc-role-version-' permission.whoId) checked=permission.documentVersion}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
@ -108,13 +92,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-success" onclick={{action 'setPermissions'}}>Save</button>
|
||||
<button type="button" class="btn btn-success" onclick= {{action 'setPermissions'}}>Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue