Skip to content

Conversation

@michielbdejong
Copy link
Member

Seeing if I can move the Workflow Engine check into the MFA Zones app to reduce the need for changes in Nextcloud Server itself.

@michielbdejong michielbdejong linked an issue Jan 8, 2024 that may be closed by this pull request
@michielbdejong
Copy link
Member Author

backend seems to work, now looking at frontend.
As per nextcloud/server#40235 (comment) maybe we can call window.OCA.WorkflowEngine.registerCheck.
Will try to copy how https://github.com/nextcloud/flow_webhooks/blob/d06203fa3cc6a5dc83b6f08ab7dd82d61585d334/src/main.js#L27 does it!

@michielbdejong
Copy link
Member Author

this.$store.getters.getChecksForEntity(this.rule.entity) is still failing. Should debug in the web console

@michielbdejong
Copy link
Member Author

It seems I'm getting close - my JS code is being compiled with Vue and executed on page load. The problem I have now is:

Object.keys(window.OCA)
Array(10) [ "Search", "Files", "Sharing", "Trashbin", "Circles", "SystemTags", "Comments", "Viewer", "Text", "Theming" ]

So WorkflowEngine is missing from that list, despite the fact that it's being set in /var/www/html/dist/workflowengine-workflowengine.js

@michielbdejong
Copy link
Member Author

Ah! It doesn't always get set.

@michielbdejong
Copy link
Member Author

When on http://sunet-nc2/index.php/settings/admin/workflow the list is different:

Object.keys(window.OCA)
Array(10) [ "Search", "WorkflowEngine", "Theming" ]

But there our mfazones code is not loaded! That is only loaded in the main files view. Will dig deeper on how NC decides which app-specific JS scripts to run on which page.

@michielbdejong
Copy link
Member Author

Ah I think I found the answer on https://docs.nextcloud.com/server/28/developer_manual/digging_deeper/flow.html

In the RegisterOperationsEvent listener we need to registere the above JS bundle.

@michielbdejong
Copy link
Member Author

I can get it to call our Application::register function from https://github.com/nextcloud/server/blob/dc2066bc26d9d92ddceaf15f9be447a5dbffb8ca/lib/private/AppFramework/Bootstrap/Coordinator.php#L142 now, I'm pretty confident now that I can get mfazones working without patches to nextcloud/server.

@michielbdejong michielbdejong merged commit 539719f into main Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try to move our check into our app

2 participants