This commit is contained in:
@@ -28,6 +28,9 @@ todo: need a role collection control of some kind for things like case 3417.
|
|||||||
todo: user options form put color picker last it's pushing down the entire last row
|
todo: user options form put color picker last it's pushing down the entire last row
|
||||||
also, can it be shorter, there's probably a setting for that
|
also, can it be shorter, there's probably a setting for that
|
||||||
|
|
||||||
|
todo: grid enum roles not always working
|
||||||
|
maybe put a role control in there or replicate that code
|
||||||
|
|
||||||
todo: need to test a license downgrade of techs once have User creation stuff done
|
todo: need to test a license downgrade of techs once have User creation stuff done
|
||||||
|
|
||||||
todo: Administration - translation
|
todo: Administration - translation
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
item-value="id"
|
item-value="id"
|
||||||
multiple
|
multiple
|
||||||
chips
|
chips
|
||||||
hint="select roles"
|
:value="selectedRoles"
|
||||||
persistent-hint
|
|
||||||
:value="rolevalue()"
|
|
||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@@ -21,23 +19,22 @@
|
|||||||
/* Xeslint-disable */
|
/* Xeslint-disable */
|
||||||
export default {
|
export default {
|
||||||
async created() {
|
async created() {
|
||||||
//get the available roles
|
|
||||||
//first make sure it's cached
|
|
||||||
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
||||||
this.availableRoles = window.$gz.enums.getSelectionList(
|
this.availableRoles = window.$gz.enums.getSelectionList(
|
||||||
"AuthorizationRoles"
|
"AuthorizationRoles"
|
||||||
);
|
);
|
||||||
//window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalValue: null,
|
internalValue: null,
|
||||||
|
selectedRoles: [],
|
||||||
availableRoles: []
|
availableRoles: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(val) {
|
value(val) {
|
||||||
this.internalValue = val;
|
this.internalValue = val;
|
||||||
|
this.setSelectedItems();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -64,12 +61,28 @@ export default {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
rolevalue() {
|
setSelectedItems() {
|
||||||
//turn ineternalValue numeric bitfield role value into list of selected roles
|
//turn internalValue numeric bitfield role value into array of selected roles
|
||||||
|
let ret = [];
|
||||||
|
if (this.internalValue != null && this.internalValue != 0) {
|
||||||
|
for (let i = 0; i < this.availableRoles.length; i++) {
|
||||||
|
let role = this.availableRoles[i];
|
||||||
|
if (!!(this.internalValue & role.id)) {
|
||||||
|
ret.push(role.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.selectedRoles = [...ret];
|
||||||
},
|
},
|
||||||
handleInput(value) {
|
handleInput(value) {
|
||||||
//turn list of selected roles into single bitfield value
|
let newValue = 0;
|
||||||
//and emit it
|
if (value != null && value != [] && value.length > 0) {
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
let role = value[i];
|
||||||
|
newValue = newValue | role;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$emit("input", newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user