Skip to content

Controlling WordPress user access to AI #10

@felixarntz

Description

@felixarntz

With this SDK, specifically with exposing the REST API endpoint, by definition we have to touch user permissions for using AI in WordPress (see e.g. https://github.com/WordPress/wp-ai-client/pull/8/files#diff-8eeed5301b6cc0c14553d0b37c4bbaa414b21ba62b35c0dfe6e1496c05de0d6bR662).

I don't think putting any Core capability in there is the right approach. We'll need to have a custom capability that can be mapped to a Core capability, to allow other code running in WordPress to control which kinds of users to grant this custom capability to. By default this needs to be limited to admins, from a security perspective, since only admins can configure the AI provider credentials, and it would not be appropriate to allow other users with fewer capabilities to use those credentials without the admin explicitly allowing that.

This is the easy part.

Now, the question is how much control do we want to provide in this package itself? Or do we leave it to each plugin to implement?

Two options:

  • Either we grant the custom capability only to admins by default (e.g. based on manage_options), and that's it. Plugins can change it.
  • Or we grant the custom capability to admins by default, and include a dropdown in the settings screen where the admin can select which minimum user role to grant the capability for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions