Skip to content

Instantly share code, notes, and snippets.

@ZhandosKz
Created August 6, 2013 16:27
Show Gist options
  • Save ZhandosKz/6166107 to your computer and use it in GitHub Desktop.
Save ZhandosKz/6166107 to your computer and use it in GitHub Desktop.
$users = User::model()->findAll();
/**
* @var CAuthManager $authManager
*/
$authManager = Yii::app()->authManager;
$statuses = array(
ExtendedDbAuthManager::APPROVED => 0,
ExtendedDbAuthManager::BANNED => 0,
ExtendedDbAuthManager::SUSPEND => 0,
ExtendedDbAuthManager::DISAPPROVED => 0
);
/**
* @var User $user
*/
foreach ($users as $user)
{
if ($authManager->checkAccess(ExtendedDbAuthManager::SUSPEND, $user->getPrimaryKey()))
{
$statuses[ExtendedDbAuthManager::SUSPEND] ++;
}
if ($authManager->checkAccess(ExtendedDbAuthManager::BANNED, $user->getPrimaryKey()))
{
$statuses[ExtendedDbAuthManager::BANNED] ++;
}
if ($authManager->checkAccess(ExtendedDbAuthManager::APPROVED, $user->getPrimaryKey()))
{
$statuses[ExtendedDbAuthManager::APPROVED] ++;
}
else
{
$statuses[ExtendedDbAuthManager::DISAPPROVED] ++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment