當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AuditEvent::getAll方法代碼示例

本文整理匯總了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";
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:31,代碼來源:AuditLog.php

示例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);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:33,代碼來源:UserTest.php


注:本文中的AuditEvent::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。