Overview

While working on #3548637: Canvas AI: Give AI more context about the libraries present in Canvas we identified the need for a dedicated permission to access and manage the configuration settings pages for Canvas AI. The existing 'use Drupal Canvas AI' permission should remain solely for its intended functionality (using the AI features), separate from administrative access.

Proposed resolution

Create a new permission administer Canvas AI which will be used for all the configuration settings pages in Canvas AI.

User interface changes

Issue fork canvas-3562580

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kunal.sachdev created an issue. See original summary.

kunal.sachdev’s picture

Issue summary: View changes
kunal.sachdev’s picture

Issue summary: View changes
kunal.sachdev’s picture

Status: Active » Needs review
narendrar’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Existing forms can be tested for permission. Write functional test for this
Eg:

    $this->drupalLogin($user_without_permission);
    $this->drupalGet('admin/config/system/canvas-ai-settings');
    $this->assertSession()->statusCodeEquals(403);
    $this->drupalGet('admin/config/system/canvas/components-for-ai');
    $this->assertSession()->statusCodeEquals(403);
    $this->drupalGet('admin/config/system/canvas-ai-settings');
    $this->assertSession()->statusCodeEquals(200);
    $this->drupalLogin($user_with_admin_permission);
    $this->drupalGet('admin/config/system/canvas/components-for-ai');
    $this->assertSession()->statusCodeEquals(200);

utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

Status: Needs work » Needs review

It's ready for a review.

wim leers’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

Why not a kernel test? See MR.