Flushes the access cache for the specified user.
@param string $itemName the name of the operation that need access check.
@param integer $userId the user id.
@return boolean whether access was flushed.
496775
public function flushAccess($itemName, $userId)
    {
        if (($cache = $this->getCache()) !== null) {
            $cacheKey = $this->resolveCacheKey($itemName, $userId);
            return $cache->delete($cacheKey);
        }
        return false;
    }
660273
private function get_gradebook_data_for_user($userid) {
        if (isset($this->gradinginfo->items[0]) && $this->gradinginfo->items[0]->grades[$userid]) {
            return $this->gradinginfo->items[0]->grades[$userid];
        }
        return false;
    }
335304
public function isOwnedBy($recordId, $userId = null)
    {
        return (bool)$this->find()
            ->where(['id' => $recordId, 'user_id' => $userId])
            ->first();
    }
872650
public function batchDelete(array $UserID)
    {
        $params = array(
                   'useridlist' => $UserID,
                  );
        return $this->http->jsonPost(self::API_BATCH_DELETE, $params);

    }
1204881
public function isAssigned($itemName,$userId)
	{
		return $this->db->createCommand()
			->select('itemname')
			->from($this->assignmentTable)
			->where('itemname=:itemname AND userid=:userid', array(
				':itemname'=>$itemName,
				':userid'=>$userId))
			->queryScalar() !== false;
	}
32043
public function delete($username): bool
    {
        $user = $this->load($username);

        $exists = $user->exists();
        if ($exists) {
            $user->delete();
        }

        return $exists;
    }
333323
public function actionRemoveParent($itemName, $parentName)
    {
        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        if ($am->hasItemChild($parentName, $itemName)) {
            $am->removeItemChild($parentName, $itemName);
            if ($am instanceof CPhpAuthManager) {
                $am->save();
            }
        }

        $this->redirect(array('view', 'name' => $itemName));
    }
390539
public function activeForUser($userId)
    {
        return $this->forUser($userId)->reject(function ($client) {
            return $client->revoked;
        })->values();
    }
768394
public static function fetch_subscription_cache($forumid, $userid) {
        if (isset(self::$forumcache[$userid]) && isset(self::$forumcache[$userid][$forumid])) {
            return self::$forumcache[$userid][$forumid];
        }
        self::fill_subscription_cache($forumid, $userid);

        if (!isset(self::$forumcache[$userid]) || !isset(self::$forumcache[$userid][$forumid])) {
            return false;
        }

        return self::$forumcache[$userid][$forumid];
    }
1120437
static function removeUser( $userID )
    {
        $user = eZUser::fetch( $userID );
        if ( !$user )
        {
            eZDebug::writeError( "unable to find user with ID $userID", __METHOD__ );
            return false;
        }

        eZUser::removeSessionData( $userID );

        eZSubtreeNotificationRule::removeByUserID( $userID );
        eZCollaborationNotificationRule::removeByUserID( $userID );
        eZUserSetting::removeByUserID( $userID );
        eZUserAccountKey::removeByUserID( $userID );
        eZForgotPassword::removeByUserID( $userID );
        eZWishList::removeByUserID( $userID );
        eZGeneralDigestUserSettings::removeByUserId( $userID );

        eZPersistentObject::removeObject( eZUser::definition(),
                                          array( 'contentobject_id' => $userID ) );
        return true;
    }
743552
public function deleteUser($userId = null, $options = []) {
		$entity = $this->_getUserEntity($userId);
		if ($this->UserTable->delete($entity)) {
			$this->handleFlashAndRedirect('success', $options);

			return true;
		} else {
			$this->handleFlashAndRedirect('error', $options);

			return false;
		}
	}
760135
protected function pforget($key, $userId)
    {
        $keys = is_array($key) ? $key : [$key];

        foreach ($keys as $key) {
            $this->cache->forget($this->pkey($key, $userId));
        }

        $this->cache->forget($this->pkey('*', $userId));
    }
119219
public function loadUserByUsername($username)
    {
        if (!isset($this->cachedUsers[$username])) {
            $this->cachedUsers[$username] = $this->userProvider->loadUserByUsername($username);
        }
        return $this->cachedUsers[$username];
    }
1110893
public function addMember($groupId, $userId)
    {
        $exists = (bool)$this
            ->database
            ->query(
                "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user",
                [':group' => $groupId, ':user' => $userId]
            )
            ->fetchField()
        ;

        if ($exists) {
            return false;
        }

        $this
            ->database
            ->merge('ucms_group_access')
            ->key([
                'group_id'  => $groupId,
                'user_id'   => $userId,
            ])
            ->execute()
        ;

        // @todo dispatch event

        $this->touch($groupId);

        $this->resetCache();

        return true;
    }
588925
public function getItemAccessControls(string $itemId, string $userId = ''):array
    {
        if (! empty($userId)) {
            return $this->get("AccessControls(principalid={$userId},itemid={$itemId})");
        } else {
            return $this->get("Items({$itemId})/AccessControls");
        }
    }
989277
public function has($itemName)
    {
        return array_key_exists($itemName, $this->store)
            && isset($this->store[$itemName]['lookupType']);
    }
1003964
public function refresh_grades($userid=0) {
        global $DB;
        if ($this->itemtype == 'mod') {
            if ($this->is_outcome_item()) {
                //nothing to do
                return true;
            }

            if (!$activity = $DB->get_record($this->itemmodule, array('id' => $this->iteminstance))) {
                debugging("Can not find $this->itemmodule activity with id $this->iteminstance");
                return false;
            }

            if (!$cm = get_coursemodule_from_instance($this->itemmodule, $activity->id, $this->courseid)) {
                debugging('Can not find course module');
                return false;
            }

            $activity->modname    = $this->itemmodule;
            $activity->cmidnumber = $cm->idnumber;

            return grade_update_mod_grades($activity, $userid);
        }

        return true;
    }