Giter Site home page Giter Site logo

Comments (4)

pbiron avatar pbiron commented on May 29, 2024

Thanx for addressing this.

For others, the underlying issue is as follows:

when VAA is run in a multisite environment and the current user is a super admin, if some other plugin has hooked into user_has_cap and the hooked function modifies a user's capabilities based on that users role, then that function hooked to user_has_cap never gets called when "Viewing as role"...because WP Core's WP_User::has_cap() short circuits when the current user is a super admin.

from view-admin-as.

JoryHogeveen avatar JoryHogeveen commented on May 29, 2024

@pbiron

Please check the latest dev branch for the fix!
https://github.com/JoryHogeveen/view-admin-as/tree/dev
PR: #54

I actually did what I proposed above (and I now see you proposed something quite similar in your plugin comments).
You can review the changes in the PR.

It's way more logical to run the user_has_cap filter at the beginning so all other plugins can run their filters based on the modified user. (I actually make temporarily changes to the current user when viewing as a role or with modified capabilities).
I've also applied the user_has_cap filter within the map_meta_cap filter to make sure these capability changes apply here as well for super admins.

Thanks again for your input.

from view-admin-as.

JoryHogeveen avatar JoryHogeveen commented on May 29, 2024

Already found the first issue.

When you are not a super admin but this plugin is still activated through the view_admin_as capability "Restrict User Access" overwrites our the full list of capabilities (priority 9).

Related: intoxstudio/restrict-user-access#11

from view-admin-as.

JoryHogeveen avatar JoryHogeveen commented on May 29, 2024

@pbiron
If you have the time, please confirm the current dev branch status fixes your problem 100%.
1.7.2-rc1 is done.

PS: Since it's related, what is your opinion on #53?

from view-admin-as.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.