Skip to content

Commit

Permalink
chore(CommunityPermissions): Disable granting admin permission for no…
Browse files Browse the repository at this point in the history
…n-owners
  • Loading branch information
micieslak committed Jan 26, 2023
1 parent 878a7ba commit e2dadeb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions storybook/pages/CommunityPermissionsSettingsPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ SplitView {
topMargin: 50
}
store: CommunitiesStore {
readonly property bool isOwner: isOwnerCheckBox.checked

assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}
channelsModel: ListModel {
Expand Down Expand Up @@ -80,6 +82,12 @@ SplitView {
SplitView.preferredHeight: 150

logsView.logText: logs.logText

CheckBox {
id: isOwnerCheckBox

text: "Is owner"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import StatusQ.Controls 0.1
import QtQuick 2.14
import QtQuick.Controls 2.14

import utils 1.0

StatusListItem {
id: root

Expand All @@ -22,10 +24,17 @@ StatusListItem {
asset.bgWidth: 32
asset.bgHeight: 32

Binding on asset.color {
when: !root.enabled
value: Style.current.darkGrey
}

components: [
StatusRadioButton {
id: radioButton

visible: root.enabled

// reference to root for better integration with ButtonGroup
// by accessing main component via ButtonGroup::checkedButton.item
readonly property alias item: root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ StatusDropdown {
property int mode: PermissionsDropdown.Mode.Add
property int initialPermissionType: PermissionTypes.Type.None

property bool disableAdminPermission: false

enum Mode {
Add, Update
}
Expand Down Expand Up @@ -93,6 +95,8 @@ StatusDropdown {
checked: d.initialPermissionType === permissionType
buttonGroup: group

enabled: !root.disableAdminPermission

Layout.fillWidth: true
}

Expand Down
2 changes: 2 additions & 0 deletions ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import QtQuick 2.0
QtObject {
id: root

readonly property bool isOwner: false

property var permissionsModel: ListModel {} // Backend permissions list object model assignment. Please check the current expected data in qml defined in `createPermissions` method
property var permissionConflict: QtObject { // Backend conflicts object model assignment. Now mocked data.
property bool exists: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ StatusScrollView {
id: permissionsDropdown

initialPermissionType: d.permissionType
disableAdminPermission: !root.store.isOwner

onDone: {
d.permissionType = permissionType
Expand Down

0 comments on commit e2dadeb

Please sign in to comment.