Skip to content

Add AccessControl Layer for WordPress #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 16, 2024
Merged

Add AccessControl Layer for WordPress #12

merged 5 commits into from
Sep 16, 2024

Conversation

doekenorg
Copy link
Collaborator

@doekenorg doekenorg commented Sep 3, 2024

This PR is in addition to UseDataKit/SDK#40 and tries to address #11.

It adds a WordPressAccessController which currently checks if the users is a admin. If they are, they have all the power; otherwise it falls back to the default ReadOnlyAccessController behaviour.

So this PR might need some (future) work, but it is already very customisable through the datakit/acl/can filter. This filter returns the current accessibility (true or false), in addition to the Capability( which contains the context to make decisions) and the current WP_User.

The ViewController and the short code now both check if the current user can see the dataview, and act accordingly.

@zackkatz I'm hoping you can fill in the blanks for me as it comes to user roles, or if this might be enough for a first iteration. We can change default behaviour later on; while maintaining the hooks for people to overwrite the logic.

@doekenorg doekenorg requested a review from zackkatz September 3, 2024 12:52
@zackkatz zackkatz requested a review from mrcasual September 4, 2024 15:18
@zackkatz
Copy link
Contributor

zackkatz commented Sep 5, 2024

@doekenorg Let's have a call about this, and I'd love @mrcasual's input.

@zackkatz zackkatz changed the base branch from main to develop September 11, 2024 15:01
@doekenorg doekenorg merged commit a67b24e into develop Sep 16, 2024
@doekenorg doekenorg deleted the feature/acl branch September 16, 2024 10:00
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.

3 participants