chore(CommunityPermissions): Disable granting admin permission for non-owners
This commit is contained in:
parent
878a7ba657
commit
e2dadeb15e
|
@ -25,6 +25,8 @@ SplitView {
|
||||||
topMargin: 50
|
topMargin: 50
|
||||||
}
|
}
|
||||||
store: CommunitiesStore {
|
store: CommunitiesStore {
|
||||||
|
readonly property bool isOwner: isOwnerCheckBox.checked
|
||||||
|
|
||||||
assetsModel: AssetsModel {}
|
assetsModel: AssetsModel {}
|
||||||
collectiblesModel: CollectiblesModel {}
|
collectiblesModel: CollectiblesModel {}
|
||||||
channelsModel: ListModel {
|
channelsModel: ListModel {
|
||||||
|
@ -80,6 +82,12 @@ SplitView {
|
||||||
SplitView.preferredHeight: 150
|
SplitView.preferredHeight: 150
|
||||||
|
|
||||||
logsView.logText: logs.logText
|
logsView.logText: logs.logText
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: isOwnerCheckBox
|
||||||
|
|
||||||
|
text: "Is owner"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import StatusQ.Controls 0.1
|
||||||
import QtQuick 2.14
|
import QtQuick 2.14
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
|
|
||||||
|
import utils 1.0
|
||||||
|
|
||||||
StatusListItem {
|
StatusListItem {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
@ -22,10 +24,17 @@ StatusListItem {
|
||||||
asset.bgWidth: 32
|
asset.bgWidth: 32
|
||||||
asset.bgHeight: 32
|
asset.bgHeight: 32
|
||||||
|
|
||||||
|
Binding on asset.color {
|
||||||
|
when: !root.enabled
|
||||||
|
value: Style.current.darkGrey
|
||||||
|
}
|
||||||
|
|
||||||
components: [
|
components: [
|
||||||
StatusRadioButton {
|
StatusRadioButton {
|
||||||
id: radioButton
|
id: radioButton
|
||||||
|
|
||||||
|
visible: root.enabled
|
||||||
|
|
||||||
// reference to root for better integration with ButtonGroup
|
// reference to root for better integration with ButtonGroup
|
||||||
// by accessing main component via ButtonGroup::checkedButton.item
|
// by accessing main component via ButtonGroup::checkedButton.item
|
||||||
readonly property alias item: root
|
readonly property alias item: root
|
||||||
|
|
|
@ -15,6 +15,8 @@ StatusDropdown {
|
||||||
property int mode: PermissionsDropdown.Mode.Add
|
property int mode: PermissionsDropdown.Mode.Add
|
||||||
property int initialPermissionType: PermissionTypes.Type.None
|
property int initialPermissionType: PermissionTypes.Type.None
|
||||||
|
|
||||||
|
property bool disableAdminPermission: false
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
Add, Update
|
Add, Update
|
||||||
}
|
}
|
||||||
|
@ -93,6 +95,8 @@ StatusDropdown {
|
||||||
checked: d.initialPermissionType === permissionType
|
checked: d.initialPermissionType === permissionType
|
||||||
buttonGroup: group
|
buttonGroup: group
|
||||||
|
|
||||||
|
enabled: !root.disableAdminPermission
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ import QtQuick 2.0
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
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 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 var permissionConflict: QtObject { // Backend conflicts object model assignment. Now mocked data.
|
||||||
property bool exists: false
|
property bool exists: false
|
||||||
|
|
|
@ -414,6 +414,7 @@ StatusScrollView {
|
||||||
id: permissionsDropdown
|
id: permissionsDropdown
|
||||||
|
|
||||||
initialPermissionType: d.permissionType
|
initialPermissionType: d.permissionType
|
||||||
|
disableAdminPermission: !root.store.isOwner
|
||||||
|
|
||||||
onDone: {
|
onDone: {
|
||||||
d.permissionType = permissionType
|
d.permissionType = permissionType
|
||||||
|
|
Loading…
Reference in New Issue