Merge pull request #5259 from Budibase/role-id-bindings
Add role IDs as bindings
This commit is contained in:
commit
1696dc3cee
|
@ -7,7 +7,11 @@ import {
|
||||||
getComponentSettings,
|
getComponentSettings,
|
||||||
} from "./componentUtils"
|
} from "./componentUtils"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import { queries as queriesStores, tables as tablesStore } from "stores/backend"
|
import {
|
||||||
|
queries as queriesStores,
|
||||||
|
tables as tablesStore,
|
||||||
|
roles as rolesStore,
|
||||||
|
} from "stores/backend"
|
||||||
import {
|
import {
|
||||||
makePropSafe,
|
makePropSafe,
|
||||||
isJSBinding,
|
isJSBinding,
|
||||||
|
@ -33,6 +37,7 @@ export const getBindableProperties = (asset, componentId) => {
|
||||||
const deviceBindings = getDeviceBindings()
|
const deviceBindings = getDeviceBindings()
|
||||||
const stateBindings = getStateBindings()
|
const stateBindings = getStateBindings()
|
||||||
const selectedRowsBindings = getSelectedRowsBindings(asset)
|
const selectedRowsBindings = getSelectedRowsBindings(asset)
|
||||||
|
const roleBindings = getRoleBindings()
|
||||||
return [
|
return [
|
||||||
...contextBindings,
|
...contextBindings,
|
||||||
...urlBindings,
|
...urlBindings,
|
||||||
|
@ -40,6 +45,7 @@ export const getBindableProperties = (asset, componentId) => {
|
||||||
...userBindings,
|
...userBindings,
|
||||||
...deviceBindings,
|
...deviceBindings,
|
||||||
...selectedRowsBindings,
|
...selectedRowsBindings,
|
||||||
|
...roleBindings,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +397,16 @@ const getUrlBindings = asset => {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRoleBindings = () => {
|
||||||
|
return (get(rolesStore) || []).map(role => {
|
||||||
|
return {
|
||||||
|
type: "context",
|
||||||
|
runtimeBinding: `trim "${role._id}"`,
|
||||||
|
readableBinding: `Role.${role.name}`,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all bindable properties exposed in a button actions flow up until
|
* Gets all bindable properties exposed in a button actions flow up until
|
||||||
* the specified action ID, as well as context provided for the action
|
* the specified action ID, as well as context provided for the action
|
||||||
|
|
Loading…
Reference in New Issue