示例#1
0
 /**
  * Get Group Role ID by name
  *
  * @param $name
  * @return Group Role ID or FALSE
  */
 private function getGroupRoleByName($name)
 {
     $group_roles = og_get_user_roles_name();
     return array_search($name, $group_roles);
 }
示例#2
0
 /**
  * @Then I should see the list of permissions for :role role
  */
 public function iShouldSeePermissionsForRole($role)
 {
     $role_names = og_get_user_roles_name();
     if ($rid = array_search($role, $role_names)) {
         $permissions = og_role_permissions(array($rid => ''));
         foreach (reset($permissions) as $machine_name => $perm) {
             // Currently the permissions returned by og for a role are only the machine name and its true value,
             // need to find a way to find the checkbox of a permission and see if it is checked
             $search = "edit-" . $rid . "-" . strtr($machine_name, " ", "-");
             if (!$this->getSession()->getPage()->hasCheckedField($search)) {
                 throw new \Exception("Permission {$machine_name} is not set for {$role}.");
             }
         }
     }
 }