public function gatekeeper($ability = null) {
    if (!isset($ability)) {
      return self::current(true)->is($this);
    }
    // Check the cache to see if we've already checked this user.
    if ($this->gatekeeperCache) {
      $abilities =& $this->gatekeeperCache;
    } else {
      $abilities = $this->abilities;
      if ($this->inheritAbilities) {
        foreach ($this->groups as &$curGroup) {
          if (!isset($curGroup->guid)) {
            continue;
          }
          $abilities = array_merge($abilities, $curGroup->abilities);
        }
        unset($curGroup);
        if (isset($this->group) && isset($this->group->guid)) {
          $abilities = array_merge($abilities, $this->group->abilities);
        }
      }
      $this->gatekeeperCache = $abilities;
    }
    if (!is_array($abilities)) {
      return false;
    }
    return (
      in_array($ability, $abilities) || in_array('system/admin', $abilities)
    );
  }