Browse Source

Merge pull request #6379 from nextcloud/feature/noid/show-permissions-icons

Show permissions icon
pull/6392/head
Joas Schilling 4 years ago
committed by GitHub
parent
commit
103280e933
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      docs/conversation.md
  2. 3
      docs/participant.md
  3. 7
      lib/Controller/RoomController.php
  4. 50
      src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue
  5. 34
      src/store/participantsStore.js

5
docs/conversation.md

@ -43,7 +43,10 @@
`attendeePin` | string | v3 | | Unique dial-in authentication code for this user, when the conversation has SIP enabled (see `sipEnabled` attribute)
`actorType` | string | v3 | | Currently known `users|guests|emails|groups|circles`
`actorId` | string | v3 | | The unique identifier for the given actor type
`permissions` | int | v4 | | Publishing permissions for the current participant (see [constants list](constants.md#attendee-permissions))
`permissions` | int | v4 | | Combined final permissions for the current participant, permissions are picked in order of attendee then call then default and the first which is `Custom` will apply (see [constants list](constants.md#attendee-permissions))
`attendeePermissions` | int | v4 | | Dedicated permissions for the current participant, if not `Custom` this are not the resulting permissions (see [constants list](constants.md#attendee-permissions))
`callPermissions` | int | v4 | | Call permissions, if not `Custom` this are not the resulting permissions, if set they will reset after the end of the call (see [constants list](constants.md#attendee-permissions))
`defaultPermissions` | int | v4 | | Default permissions for new participants (see [constants list](constants.md#attendee-permissions))
`participantInCall` | bool | v1 | v2 | **Removed:** use `participantFlags` instead
`participantFlags` | int | v1 | | "In call" flags of the user's session making the request (only available with `in-call-flags` capability)
`readOnly` | int | v1 | | Read-only state for the current user (only available with `read-only-rooms` capability)

3
docs/participant.md

@ -34,7 +34,8 @@
`participantType` | int | v1 | | Permissions level of the participant (see [constants list](constants.md#participant-types))
`lastPing` | int | v1 | | Timestamp of the last ping of the user (should be used for sorting)
`inCall` | int | v1 | | Call flags the user joined with (see [constants list](constants.md#participant-in-call-flag))
`permissions` | int | v4 | | Publishing permissions for the participant (see [constants list](constants.md#attendee-permissions))
`permissions` | int | v4 | | Combined final permissions for the participant, permissions are picked in order of attendee then call then default and the first which is `Custom` will apply (see [constants list](constants.md#attendee-permissions))
`attendeePermissions` | int | v4 | | Dedicated permissions for the current participant, if not `Custom` this are not the resulting permissions (see [constants list](constants.md#attendee-permissions))
`sessionId` | string | v1 | v4 | `'0'` if not connected, otherwise a 512 character long string
`sessionIds` | array | v4 | | array of session ids, each are 512 character long strings, or empty if no session
`status` | string | v2 | | Optional: Only available with `includeStatus=true`, for users with a set status and when there are less than 100 participants in the conversation

7
lib/Controller/RoomController.php

@ -407,6 +407,9 @@ class RoomController extends AEnvironmentAwareController {
'actorId' => '',
'attendeeId' => 0,
'permissions' => Attendee::PERMISSIONS_CUSTOM,
'attendeePermissions' => Attendee::PERMISSIONS_CUSTOM,
'callPermissions' => Attendee::PERMISSIONS_CUSTOM,
'defaultPermissions' => Attendee::PERMISSIONS_CUSTOM,
'canEnableSIP' => false,
'attendeePin' => '',
'description' => '',
@ -473,6 +476,9 @@ class RoomController extends AEnvironmentAwareController {
'actorId' => $attendee->getActorId(),
'attendeeId' => $attendee->getId(),
'permissions' => $currentParticipant->getPermissions(),
'attendeePermissions' => $attendee->getPermissions(),
'callPermissions' => $room->getCallPermissions(),
'defaultPermissions' => $room->getDefaultPermissions(),
'description' => $room->getDescription(),
'listable' => $room->getListable(),
]);
@ -957,6 +963,7 @@ class RoomController extends AEnvironmentAwareController {
'actorType' => $participant->getAttendee()->getActorType(),
'displayName' => $participant->getAttendee()->getActorId(),
'permissions' => $participant->getPermissions(),
'attendeePermissions' => $participant->getAttendee()->getPermissions(),
'attendeePin' => '',
];
if ($this->talkConfig->isSIPConfigured()

50
src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue

@ -111,6 +111,21 @@
:aria-label="participantSettingsAriaLabel"
:force-menu="true"
class="participant-row__actions">
<template v-if="actionIcon !== ''"
#icon>
<LockOpenVariant
v-if="actionIcon === 'LockOpenVariant'"
:size="20"
decorative />
<Lock
v-if="actionIcon === 'Lock'"
:size="20"
decorative />
<Tune
v-if="actionIcon === 'Tune'"
:size="20"
decorative />
</template>
<ActionText
v-if="attendeePin"
:title="t('spreed', 'Dial-in PIN')"
@ -217,6 +232,14 @@ import ActionText from '@nextcloud/vue/dist/Components/ActionText'
import ActionSeparator from '@nextcloud/vue/dist/Components/ActionSeparator'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import { CONVERSATION, PARTICIPANT, ATTENDEE } from '../../../../../constants'
import UserStatus from '../../../../../mixins/userStatus'
import readableNumber from '../../../../../mixins/readableNumber'
import isEqual from 'lodash/isEqual'
import AvatarWrapper from '../../../../AvatarWrapper/AvatarWrapper'
import ParticipantPermissionsEditor from './ParticipantPermissionsEditor/ParticipantPermissionsEditor.vue'
// Material design icons
import Microphone from 'vue-material-design-icons/Microphone'
import Phone from 'vue-material-design-icons/Phone'
import Video from 'vue-material-design-icons/Video'
@ -224,14 +247,9 @@ import Crown from 'vue-material-design-icons/Crown.vue'
import Account from 'vue-material-design-icons/Account.vue'
import Lock from 'vue-material-design-icons/Lock.vue'
import LockOpenVariant from 'vue-material-design-icons/LockOpenVariant.vue'
import Tune from 'vue-material-design-icons/Tune.vue'
import Pencil from 'vue-material-design-icons/Pencil.vue'
import HandBackLeft from 'vue-material-design-icons/HandBackLeft'
import { CONVERSATION, PARTICIPANT, ATTENDEE } from '../../../../../constants'
import UserStatus from '../../../../../mixins/userStatus'
import readableNumber from '../../../../../mixins/readableNumber'
import isEqual from 'lodash/isEqual'
import AvatarWrapper from '../../../../AvatarWrapper/AvatarWrapper'
import ParticipantPermissionsEditor from './ParticipantPermissionsEditor/ParticipantPermissionsEditor.vue'
export default {
name: 'Participant',
@ -242,6 +260,9 @@ export default {
ActionText,
ActionSeparator,
AvatarWrapper,
ParticipantPermissionsEditor,
// Material design icons
Microphone,
Phone,
Video,
@ -251,7 +272,7 @@ export default {
Lock,
LockOpenVariant,
Pencil,
ParticipantPermissionsEditor,
Tune,
},
directives: {
@ -557,6 +578,21 @@ export default {
}
return undefined
},
attendeePermissions() {
return this.participant.attendeePermissions
},
actionIcon() {
if (this.attendeePermissions === PARTICIPANT.PERMISSIONS.MAX_CUSTOM) {
return 'LockOpenVariant'
} else if (this.attendeePermissions === PARTICIPANT.PERMISSIONS.CUSTOM) {
return 'Lock'
} else if (this.attendeePermissions !== PARTICIPANT.PERMISSIONS.DEFAULT) {
return 'Tune'
}
return ''
},
},
methods: {

34
src/store/participantsStore.js

@ -240,32 +240,6 @@ const mutations = {
Vue.delete(state.peers, token)
}
},
addPermissions(state, { token, attendeeId, permissions }) {
if (state.attendees[token] && state.attendees[token][attendeeId]) {
const PREVIOUS_PERMISSIONS = state.attendees[token][attendeeId].permissions
Vue.set(state.attendees[token][attendeeId], 'permissions', PREVIOUS_PERMISSIONS | permissions)
} else {
console.error('Error while updating the participant')
}
},
removePermissions(state, { token, attendeeId, permissions }) {
if (state.attendees[token] && state.attendees[token][attendeeId]) {
const PREVIOUS_PERMISSIONS = state.attendees[token][attendeeId].permissions
Vue.set(state.attendees[token][attendeeId], 'permissions', PREVIOUS_PERMISSIONS & ~permissions)
} else {
console.error('Error while updating the participant')
}
},
setPermissions(state, { token, attendeeId, permissions }) {
if (state.attendees[token] && state.attendees[token][attendeeId]) {
Vue.set(state.attendees[token][attendeeId], 'permissions', permissions)
} else {
console.error('Error while updating the participant')
}
},
}
const actions = {
@ -592,6 +566,7 @@ const actions = {
await grantAllPermissionsToParticipant(token, attendeeId)
const updatedData = {
permissions: PARTICIPANT.PERMISSIONS.MAX_CUSTOM,
attendeePermissions: PARTICIPANT.PERMISSIONS.MAX_CUSTOM,
}
context.commit('updateParticipant', { token, attendeeId, updatedData })
},
@ -608,6 +583,7 @@ const actions = {
await removeAllPermissionsFromParticipant(token, attendeeId)
const updatedData = {
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
attendeePermissions: PARTICIPANT.PERMISSIONS.CUSTOM,
}
context.commit('updateParticipant', { token, attendeeId, updatedData })
},
@ -624,7 +600,11 @@ const actions = {
*/
async setPermissions(context, { token, attendeeId, permissions }) {
await setPermissions(token, attendeeId, permissions)
context.commit('setPermissions', { token, attendeeId, permissions })
const updatedData = {
permissions,
attendeePermissions: permissions,
}
context.commit('updateParticipant', { token, attendeeId, updatedData })
},
}

Loading…
Cancel
Save