If no roles are selected for a license type, all roles should be restricted. This does not work for me. I am on core 8.2.6.

In function licensing_license_type_applies_to_user there is a check for empty roles:

if (empty($license_type->get('roles')) || array_intersect($account->getRoles(), $license_type->get('roles'))) {

license_type->get('roles') returns an array of defined roles ie : Array ( [authenticated] => 0 [administrator] => 0 [storeowner] => 0 ) ) and therefor the empty check does not work as expected.

I have attached a patch that filters out empty values in the array before the empty check.

CommentFileSizeAuthor
#2 restricted_roles-2849725-1.patch596 bytestbrix
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tbrix created an issue. See original summary.

tbrix’s picture

trigdog’s picture

Status: Active » Needs review