コード例 #1
0
ファイル: Admin.php プロジェクト: kingsj/core
 /**
  * Submit admin permissions form
  *
  * @param array &$form      Form description
  * @param array &$formState Form state
  *
  * @return void
  */
 public function submitUserPermissionsForm(array &$form, array &$formState)
 {
     return \XLite\Module\CDev\DrupalConnector\Drupal\Profile::getInstance()->performActionUpdateRoles(user_roles());
 }
コード例 #2
0
ファイル: Profile.php プロジェクト: kingsj/core
 /**
  * Find users with drupal roles with permission 'lc admin' and update access level
  *
  * @return void
  */
 protected function updateAdminAccessLevels()
 {
     // Drupal's function user_roles()
     $roles = user_roles();
     // Prepare list of roles with 'lc admin' permission
     $adminRoles = array();
     foreach ($roles as $roleId => $roleName) {
         if (\XLite\Module\CDev\DrupalConnector\Drupal\Profile::isRoleHasAdminPermission(array($roleId => $roleName))) {
             $adminRoles[] = $roleId;
         }
     }
     // Find admin profiles with non-admin roles and update their access level to customer
     $this->updateAccessLevel(\XLite\Core\Database::getRepo('\\XLite\\Model\\Profile')->findAdminsWithoutRoles($adminRoles), \XLite\Core\Auth::getInstance()->getCustomerAccessLevel());
     //Find non-admin profiles with admin roles and update their access level to administrator
     $this->updateAccessLevel(\XLite\Core\Database::getRepo('\\XLite\\Model\\Profile')->findCustomersWithRoles($adminRoles), \XLite\Core\Auth::getInstance()->getAdminAccessLevel());
 }