resetAllRoles() public static méthode

Reset permissions for all roles, based on the value in their Type column.
public static resetAllRoles ( string $Type = null )
$Type string Role type to limit the updates to.
 /**
  * Reset all role permissions based on role type.
  */
 public function resetPermissions()
 {
     $this->permission('Garden.Settings.Manage');
     if ($this->Request->isAuthenticatedPostBack()) {
         PermissionModel::resetAllRoles();
         $this->setData('Result', array('Complete' => true));
     }
     $this->setData('Title', 'Reset all role permissions');
     $this->_setJob($this->data('Title'));
     $this->addSideMenu();
     $this->render('Job');
 }
Exemple #2
0
 /**
  * After executing /settings/utility/update check if any role permissions have been changed, if not reset all the permissions on the roles.
  *
  * @param $sender
  */
 public function updateModel_afterStructure_handler($sender)
 {
     // Only setup default permissions if no role permissions are set.
     $hasPermissions = Gdn::sql()->getWhere('Permission', array('RoleID >' => 0))->firstRow(DATASET_TYPE_ARRAY);
     if (!$hasPermissions) {
         PermissionModel::resetAllRoles();
     }
 }
 /**
  *
  *
  * @return bool
  */
 public function customFinalization()
 {
     $this->setRoleDefaults();
     PermissionModel::resetAllRoles();
     $Imp = $this->getCustomImportModel();
     if ($Imp !== null) {
         $Imp->afterImport();
     }
     return true;
 }
 /**
  *
  *
  * @return bool
  */
 public function customFinalization()
 {
     $this->setRoleDefaults();
     PermissionModel::resetAllRoles();
     // Remove invalid relation between non existing users/roles
     RoleModel::cleanUserRoles();
     $Imp = $this->getCustomImportModel();
     if ($Imp !== null) {
         $Imp->afterImport();
     }
     return true;
 }