* feat: allow wildcard for doctype in permission hooks
* fix: pass doctype to permission query
* fix: combine methods instead of alternate
* test: wildcard has_permssion hook
* test: wildcard has_permssion make note public
* fix: fetch list of hooks once
* fix: Avoid possible cache eviction issue
Clear cache after removing data from DB, so a concurrent request can't put stale data in cache.
* fix: explicitly login as guest after logging out
Avoids problem with some other code potentially re-adding current
session in cache or DB.
* test: avoid hard coded admin pw
* test: reset user after running tests
* fix: only login as guest if in request
Background jobs, some other user disabling someone else etc
Steps to repro:
- Setup show title in link field
- on list view filter by that field
- Use the URL and open the page again
- filters will be erased
This is happening because:
- title->value map needs a db call to complete
- in meantime if we ask for input value we get empty value (because input is empty) and then we end up returning `""`
`make_control` doesn't return anything when the control name is invalid
Handle in `make_field` and `init_field`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
- no more "can subscribe X"
- add a new util function on socket `has_permission`
Basic usage:
```js
socket.has_permission(doctype, [name]).then(() => { // do something });
```
You can now specify custom event handlers for SocketIO.
Usage:
1. In your app's hooks.py add `has_realtime_event_handlers=True` so
Framework can assume your app contains custom handler and import them.
2. Create a file called `/app/realtime/handlers.js` with single module
export a function that will setup handlers using socket.
Here's sample code:
```js
// This is /app_root/realtime/handler.js`
function chat_app_handlers(socket) {
socket.on("hello_chat") {
console.log("hello world!");
}
}
module.exports = chat_app_handlers;
```
3. Restart SocketIO server and see if it worked by sending event from
client. In desk based app you can do
`frappe.realtime.socket.emit("hello_chat")`
Middlewares are not yet possible... will be worked upon __some other day__ [tm]
closes https://github.com/frappe/frappe/issues/21528