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
Implement core/site/data/connection REST route #998
Comments
@felixarntz is this a public endpoint? If not, what permissions does it require? |
@aaemnnosttv It should be using |
@felixarntz I'm noticing while looking into this that |
@aaemnnosttv Hmm that's tricky. I feel like we should try to find a solution that is internal to
Not sure on the solution, but let's try to find something that generally works for the encryption "adapters" internally. |
@felixarntz One solution here is to change Adding an ... After a bit more thinking, I'm thinking maybe we should re-implement the encryption to happen using WordPress sanitization callbacks and |
That sounds good to me. Let's name it
I thought about this yesterday as well, and it seems clean to me, but I'm a bit wary of unexpected side effects here because of how obscure core behaves sometimes - particularly because we would be changing the data type of the value by encrypting/decrypting. It's something to keep in mind for potential refactoring and testing in the future, but for now, let's keep the encryption out of tying in too deeply with core option functions - especially given that meta wouldn't support it anyway. |
@felixarntz
Yeah, the lack of support for the same pattern with meta is a deal-breaker for sure. |
What do you mean? What I wanted to say is just to introduce |
Ok that makes sense. For |
I don't think so, it's just overloaded. We could actually add a |
In the case of |
We can just maintain how it is currently - we would call |
Ok, that works. I was thinking that we would add a method to |
IB ✅ |
CR ✅ Ready for merge 👍 |
QA ✅ The REST API endpoint exists and works as expected here. |
Feature Description
There should be a REST route exposing basic connection information and related data that is site-specific (explicitly not user-specific), inspired by what is currently handled in
Authentication::inline_js_setup_data()
.This is PHP work, but still a requirement for following JS refactoring.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
core/site/data/connection
REST route that is accessible viaGET
.connected
: boolean whether there are site credentialsresettable
: boolean whether there is data to resetImplementation Brief
REST_Routes
core/site/data/connection
GET
'permission_callback' => $can_setup,
connected: Credentials->has()
resettable
: true if credentials option is setSettings
Credentials
inAuthentication::register()
Data_Encryption::get()
to remove early return if! $raw_value
decrypt
if$raw_value
is a string (if not, return$raw_value
as it is not encrypted)public has( $option ): bool
toOptions_Interface
Options
andEncrypted_Options
to implement the new methodOptions::has()
, callget()
and then check if the option name exists as a key onwp_cache_get( 'notoptions', 'options' )
to prevent unnecessary DB queriesEncrypted_Options::has()
proxy the call to$this->options->has( $option )
Setting
to include ahas
method which calls$this->options->has( static::OPTION )
Changelog entry
core/site/data/connection
REST API route for retrieving site connection info.The text was updated successfully, but these errors were encountered: