0

Suppose we have 20 webforms A user which has Admin role as well User1 role should only view its corresponding webform (eg: weform1 and webform2)rest webform should not display at(admin/content,/admin/content/webform) when he logged in as a user which is having User1+Admin role.

How to achieve this?

0

As per my knowledge you need to do little customization to achieve this.

  1. Check the roles
  2. Perform your require action(permission)

code to check logged in user has both roles?

global $user;
$roleA = 'administrator';
$roleB = 'user1';
$roleC = 'some other role';
$user_roles = array_values($user->roles);

    if (in_array($roleA, $user_roles) && in_array($roleC, $user_roles)) {
      // Do something.
    }
    elseif (in_array($roleA, $user_roles) && in_array($roleB, $user_roles)) {
      // Do something.
    }
    elseif (in_array($roleB, $user_roles) && in_array($roleC, $user_roles)) {
      // Do something.
    }

Second option.

You can look Rules module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy