本文整理汇总了PHP中AuditEvent::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP AuditEvent::getAll方法的具体用法?PHP AuditEvent::getAll怎么用?PHP AuditEvent::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuditEvent
的用法示例。
在下文中一共展示了AuditEvent::getAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the Zurmo
* logo and Zurmo copyright notice. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display the words
* "Copyright Zurmo Inc. 2014. All rights reserved".
********************************************************************************/
require_once '../../config/debug.php';
require_once '../common/bootstrap.php';
if (!($argc == 1 || $argc == 3 && $argv[1] == '-n' && is_numeric($argv[2]))) {
echo "\nAuditLog - Displays the audit log.\nUsage: php AuditLog.php [-n #]\nOptions: -n # Displays the tail of the log up to # entries.\n";
exit;
}
$count = $argc == 3 ? intval($argv[2]) : null;
try {
RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
} catch (Exception $e) {
echo "Could not open the database.\n";
exit;
}
try {
Yii::app()->user->userModel = User::getByUsername('super');
} catch (Exception $e) {
echo "Super user does not exist.\n";
exit;
}
$AuditEventsList = $count === null ? AuditEvent::getAll() : AuditEvent::getTailEvents($count);
foreach ($AuditEventsList as $auditEvent) {
$moduleName = $auditEvent->moduleName;
echo $moduleName::stringifyAuditEvent($auditEvent) . "\n";
}
echo '(' . count($AuditEventsList) . " events)\n";
示例2: testLogAuditEventsForIsActive
public function testLogAuditEventsForIsActive()
{
$user = new User();
$user->username = 'testlogauditforisactive';
$user->title->value = 'Mr.';
$user->firstName = 'My';
$user->lastName = 'testlogauditforisactive';
$user->setPassword('testlogauditforisactive');
$this->assertTrue($user->save());
unset($user);
$user = User::getByUsername('testlogauditforisactive');
$this->assertEquals(1, $user->isActive);
unset($user);
AuditEvent::deleteAll();
//Change the user's status to inactive and confirm new audit event is created
$user = User::getByUsername('testlogauditforisactive');
$user->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB, RIGHT::DENY);
$this->assertTrue($user->save());
$this->assertEquals(0, $user->isActive);
$auditEvents = AuditEvent::getAll();
$this->assertCount(1, $auditEvents);
$this->assertContains('Item Modified', strval($auditEvents[0]));
unset($user);
//Now change the user's status back to active and confirm new audit event is created
$user = User::getByUsername('testlogauditforisactive');
$user->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB, RIGHT::ALLOW);
$this->assertTrue($user->save());
$this->assertEquals(1, $user->isActive);
$auditEvents = AuditEvent::getAll();
$this->assertCount(2, $auditEvents);
$this->assertContains('Item Modified', strval($auditEvents[1]));
unset($user);
}