code: protected function removeAllItems($type)
      {
          if (!$this->supportsCascadeUpdate()) {
              $names = (new Query())
                  ->select(['name'])
                  ->from($this->itemTable)
                  ->where(['type' => $type])
                  ->column($this->db);
              if (empty($names)) {
                  return;
              }
              $key = $type == Item::TYPE_PERMISSION ? 'child' : 'parent';
              $this->db->createCommand()
                  ->delete($this->itemChildTable, [$key => $names])
                  ->execute();
              $this->db->createCommand()
                  ->delete($this->assignmentTable, ['item_name' => $names])
                  ->execute();
          }
          $this->db->createCommand()
              ->delete($this->itemTable, ['type' => $type])
              ->execute();
  
          $this->invalidateCache();
      }
docs: Removes all auth items of the specified type.
  @param int $type the auth item type (either Item::TYPE_PERMISSION or Item::TYPE_ROLE)