-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2373 from owncloud/bugfix/sharing-bit-masking
Refactor collaborators to use helper classes and to map permissions
- Loading branch information
Showing
25 changed files
with
789 additions
and
541 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
apps/files/src/components/Collaborators/AdditionalPermissions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<oc-grid gutter="small"> | ||
<label v-for="permission in permissions" :key="permission.name" class="files-collaborators-permission-label"> | ||
<oc-checkbox | ||
:id="`files-collaborators-permission-${permission.name}`" | ||
class="uk-margin-xsmall-right files-collaborators-permission-checkbox" | ||
v-model="permission.value" | ||
@change="permissionChecked" | ||
/> | ||
{{ permission.description }} | ||
</label> | ||
</oc-grid> | ||
</template> | ||
|
||
<script> | ||
import filterObject from 'filter-obj' | ||
export default { | ||
name: 'AdditionalPermissions', | ||
props: { | ||
/** | ||
* Available permissions for the role | ||
*/ | ||
availablePermissions: { | ||
type: Object, | ||
required: true | ||
}, | ||
/** | ||
* Additional permissions of the collaborator with values | ||
*/ | ||
collaboratorsPermissions: { | ||
type: Object, | ||
required: false | ||
} | ||
}, | ||
computed: { | ||
permissions () { | ||
const permissions = this.availablePermissions | ||
for (const permission in permissions) { | ||
if (this.collaboratorsPermissions && this.collaboratorsPermissions[permission]) { | ||
permissions[permission].value = true | ||
continue | ||
} | ||
permissions[permission].value = false | ||
} | ||
return permissions | ||
} | ||
}, | ||
methods: { | ||
permissionChecked () { | ||
const selectedPermissions = [] | ||
const permissions = filterObject(this.permissions, (key, value) => { | ||
return value.value === true | ||
}) | ||
for (const permission in permissions) { | ||
selectedPermissions.push(permission) | ||
} | ||
this.$emit('permissionChecked', selectedPermissions) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.