Disable Tags Creation for non-Admins

Hi! Anyone knows how to do this? I bet this would help some people as well to disallow random tag creation and only allow users to choose from existing tags when editing or creating a task. Hope anyone can help and wishing them thanks and merry christmas in advance!

1 Like

Bumping for help needed! Thanks in advance! :slight_smile:

I see the point, and I find this a very reasonable request. Unfortunately, I don’t have a solution for you. You need to create a plugin that overlays to templates for task creation, edit and bulk add.

2 Likes

no, i think its actually 1 line of code in a plugin.php.

$this->projectAccessMap->add('TagController', array('create', 'save', 'edit', 'update', 'confirm', 'remove'), Role::APP_ADMIN);

3 Likes

go to your plugin folder, make a directory called AdminTags

make a file in said directory called Plugin.php

paste this code in it:

<?php

namespace Kanboard\Plugin\AdminTags;

use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
use Kanboard\Core\Security\Role;

class Plugin extends Base
{
  public function initialize()
  {
    $this->projectAccessMap->add('TagController', array('create', 'save', 'edit', 'update', 'confirm', 'remove'), Role::APP_ADMIN);
  }
  public function getPluginName()
  {
    return 'AdminTags';
  }
  public function getPluginAuthor()
  {
    return 'Your name';
  }
  public function getPluginVersion()
  {
    return '1.0.0';
  }
  
  public function getPluginDescription()
  {
    return 'Restricts tag creation to admins';
  }
  public function getPluginHomepage()
  {
    return '';
  }
}

im on a cell phone so, id check for typos…

Restart kanboard server, test. if that doesnt work, then yes, like alfred said you will need to override some templates. But im 80% sure this is all you need.

After getting home and actually taking a look, unfortunately, the task modification/creation forms go straight to the models, and not through the controllers.

So, this is pretty much a pain in the butt to do. It’s not even as simple as overriding templates.

1 Like

Hi! Appreciate the help in entertaining my concern @alfredb @creecros

So does this mean it’s not something that’s easily done by modifying some codes on the .php files?

1 Like

if you know what you are doing you can pull it off. i could do it, but i dont feel like investing the time to do it, as it will not be simple. sorry.