Code Monkey home page Code Monkey logo

Comments (5)

luiges90 avatar luiges90 commented on August 30, 2024

I think it is not possible to determine which blog_id we should use simply in the abstraction layer of this bundle. The blog_id would be passed from higher abstraction layer.

i.e. The user would determine when to use the settings from site 1 (wp_capabilities), when to use site 2 (wp_2_capabilities), etc...

To make $this->get('security.context')->isGranted('ROLE_WP_ADMINISTRATOR') work, we need to somehow let the security context knows which site we are talking about.

I am thinking about creating multiple security contexts. However, to make our bundle works in any number of sites, we would need to somehow create a Security Context Factory, and this entails a Firewall Factory. Can Symfony do that? hm...

A mere constant explodes into much more difficult solution, ouch...

Let's see if there are easier way first.


As a side note, we could use Firewall request matchers if we need to decide which firewall to use by host.

from kayuewordpressbundle.

luiges90 avatar luiges90 commented on August 30, 2024

A quick, dirty and inherently stupid way would be add a new method getRolesOfSite($site) in User, but this wouldn't be able to take advantage of Symfony role hierarchy and this would cause code duplication (coding the hierarchy in many places)

from kayuewordpressbundle.

luiges90 avatar luiges90 commented on August 30, 2024

Looking into securityContext->isGranted and see if we can change something in it

from kayuewordpressbundle.

mattsnowboard avatar mattsnowboard commented on August 30, 2024

Also, what about the "site_admins" key in "wp_sitemeta"?
I'd like to add a ROLE_WP_SUPER_ADMIN role in that case.

But I think that involves adding support to read that table into entities, then decoding that key into an array and searching for the user in that array. I'm not sure the best place to put it in. I suppose it would have to happen around when the user is loaded from the provider?

from kayuewordpressbundle.

kayue avatar kayue commented on August 30, 2024

@mattsnowboard Actually you can use Security Voter in Symfony to check user role.

Somthing similar to this: https://gist.github.com/kayue/f563394b7ee35a326aad

from kayuewordpressbundle.

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.