This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

alezzzzz
alezzzzz

Whenever I try to add a new Bakcend user Role it always becomes a system role, uneditable and with no permissions added to it.

It seems this function always returns true:

public function isSystemRole()
{
    if (!$this->code || !strlen(trim($this->code))) {
        return false;
    }

    if ($this->is_system || in_array($this->code, [
        self::CODE_DEVELOPER,
        self::CODE_PUBLISHER
    ])) {
        return true;
    }

    return AuthManager::instance()->hasPermissionsForRole($this->code);
}

In fact AuthManager::instance()->hasPermissionsForRole($this->code); always returns true even when I add permissions to it.

I tried updating october but there a no new updates available and If I try to find out my october cms version using php artisan october:version it returns an error as it tries to load a file that is missing: https://raw.githubusercontent.com/octoberrain/meta/master/manifest/builds.json

Last updated

alezzzzz
alezzzzz

Fixed! That was my fault, but it was weird that it worked fine in the development server but not in the production one.

I was registering permissions this way:

public function registerPermissions()
{
    return [
        'aristamedia.affiliatecampaigns.affiliate_reporting' => [
            'label' => 'View Affiliate Reporting',
            'tab' => 'Reporting',
            'order' => 200,
            'roles' => ['affiliates']
        ]
    ];
}

Just needed to remove the last line 'roles' => ['affiliates'].

From this page: https://octobercms.com/docs/backend/users#permission-registration

"You may also specify a roles option as an array with each value as a role API code. When a role is created with this code, it becomes a system role that always grants this permission to users with that role."

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.