silverstripe cms security tab search bar

4

I need to add search option to cms security tab how can i do it?

Other tabs can do those. but security tab can’t. I need to search roles, members and groups with filters.

Member and Roles have search forms available out of the box, exactly the same as the Pages section.
This should also be true of Groups, but there is a bug which is stopping the search form from being provided. You can see the issue about that on github.

This was brought up about a couple of weeks ago on the public slack, and a user there proposed a solution with an extension for the SecurityAdmin class that implements updateEditForm like this:

public function updateEditForm(Form $form)
    {
        $f = $form->fields();
        /** @var GridField $groupField */
        $groupField = $f->fieldByName('Root.Groups.Groups');
        $config = $groupField->getConfig();

        $dataColumns = $config->getComponentByType(GridFieldDataColumns::class);
        $dataColumns->setDisplayFields([
            'Title' => 'Title'
        ]);
        
        return $f;
    }

Although someone else pointed out, regarding the above method: “you are not showing the full breadcrumbs for the groups anymore, only their title. If you still want to show the breadcrumbs, you could add another column (for example just the ID column) that is filterable.”

1 Like

thanks, i will look :heart_eyes: