当前位置: 首页>>代码示例>>PHP>>正文


PHP AllPermissionsOptimizationUtil类代码示例

本文整理汇总了PHP中AllPermissionsOptimizationUtil的典型用法代码示例。如果您正苦于以下问题:PHP AllPermissionsOptimizationUtil类的具体用法?PHP AllPermissionsOptimizationUtil怎么用?PHP AllPermissionsOptimizationUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AllPermissionsOptimizationUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeAll

 /**
  * @param DemoDataHelper $demoDataHelper
  */
 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("User")');
     $missions = array();
     foreach (self::getMissionData() as $randomMissionData) {
         $postData = array();
         $mission = new Mission();
         $mission->setScenario('importModel');
         $mission->status = Mission::STATUS_AVAILABLE;
         $mission->owner = $demoDataHelper->getRandomByModelName('User');
         $mission->createdByUser = $mission->owner;
         $mission->description = $randomMissionData['description'];
         $mission->reward = $randomMissionData['reward'];
         //Add some comments
         foreach ($randomMissionData['comments'] as $commentDescription) {
             $comment = new Comment();
             $comment->setScenario('importModel');
             $comment->createdByUser = $demoDataHelper->getRandomByModelName('User');
             $comment->description = $commentDescription;
             $mission->comments->add($comment);
         }
         $mission->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
         $saved = $mission->save();
         assert('$saved');
         $mission = Mission::getById($mission->id);
         AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, Group::getByName(Group::EVERYONE_GROUP_NAME));
         $mission->save();
         $missions[] = $mission->id;
     }
     $demoDataHelper->setRangeByModelName('Mission', $missions[0], $missions[count($missions) - 1]);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:MissionsDemoDataMaker.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     AllPermissionsOptimizationUtil::rebuild();
     SecurityTestHelper::createUsers();
     $billy = User::getByUsername('billy');
     EmailMessageTestHelper::createEmailAccount($billy);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_CREATE_CONTACTS);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_DELETE_CONTACTS);
     assert($billy->save());
     // Not Coding Standard
     $contact = ContactTestHelper::createContactByNameForOwner('sally', Yii::app()->user->userModel);
     $contact->primaryEmail = new Email();
     $contact->primaryEmail->emailAddress = 'sally@zurmoland.com';
     $contact->secondaryEmail->emailAddress = 'toMakeSureNoFreeze@works.com';
     $contact->addPermissions($billy, Permission::READ);
     $contact->addPermissions($billy, Permission::WRITE);
     $contact->save();
     $molly = ContactTestHelper::createContactByNameForOwner('molly', User::getByUsername('bobby'));
     $molly->primaryEmail = new Email();
     $molly->primaryEmail->emailAddress = 'molly@zurmoland.com';
     $molly->secondaryEmail->emailAddress = 'toMakeSureNoFreeze@works.zur';
     $molly->save();
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($contact, $billy);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:28,代码来源:EmailMessageUtilTest.php

示例3: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     AllPermissionsOptimizationUtil::rebuild();
     SecurityTestHelper::createSuperAdmin();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     assert($everyoneGroup->save());
     // Not Coding Standard
     $group1 = new Group();
     $group1->name = 'Group1';
     assert($group1->save());
     // Not Coding Standard
     $group2 = new Group();
     $group2->name = 'Group2';
     assert($group2->save());
     // Not Coding Standard
     $group3 = new Group();
     $group3->name = 'Group3';
     assert($group3->save());
     // Not Coding Standard
     $group4 = new Group();
     $group4->name = 'Group4';
     assert($group4->save());
     // Not Coding Standard
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:25,代码来源:ExplicitReadWriteModelPermissionsUtilTest.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     $account2 = AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account2);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact3', $super, $account);
     $contact4 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact4', $super, $account2);
     $contact5 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact5', $super, $account);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1', 'MarketingList Description1');
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2', 'MarketingList Description2');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact2);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact3);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact4);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact5);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList2, $contact2);
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:MarketingListDefaultPortletControllerSuperUserWalkthroughTest.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
     $super = User::getByUsername('super');
     //Steven have access to missions module
     $steven = UserTestHelper::createBasicUser('steven');
     $steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
     $steven->save();
     //Jack dont have acess to missions module
     $jack = UserTestHelper::createBasicUser('jack');
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
     assert($mission->save());
     // Not Coding Standard
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:25,代码来源:MissionsUtilTest.php

示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $nobody = UserTestHelper::createBasicUser('nobody');
     $nobody->setRight('MarketingListsModule', MarketingListsModule::getAccessRight());
     $saved = $nobody->save();
     static::assertTrue($saved);
     Yii::app()->user->userModel = $nobody;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('nobodyAccount', $nobody);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1', 'MarketingList Description1');
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2', 'MarketingList Description2');
     for ($i = 0; $i < 17; $i++) {
         if ($i % 2) {
             $unsubscribed = 0;
         } else {
             $unsubscribed = 1;
         }
         $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact1' . $i, $nobody, $account);
         $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact2' . $i, $nobody, $account);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList1, $contact1);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList2, $contact2);
     }
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:MarketingListMemberControllerRegularUserWalkthroughTest.php

示例7: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:EmailArchivingUtilTest.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     // set up data owned by super
     Yii::app()->user->userModel = User::getByUsername('super');
     $account1 = AccountTestHelper::createAccountByNameForOwner('account1', Yii::app()->user->userModel);
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('contact1', Yii::app()->user->userModel, $account1);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('contact2', Yii::app()->user->userModel, $account1);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('contact3', Yii::app()->user->userModel, $account1);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact2);
     $member1 = MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact3);
     static::$superUserMarketingListId = $marketingList1->id;
     static::$superUserMemberId = $member1->id;
     // set up data owned by nobody
     Yii::app()->user->userModel = UserTestHelper::createBasicUser('nobody');
     $account2 = AccountTestHelper::createAccountByNameForOwner('account2', Yii::app()->user->userModel);
     $contact4 = ContactTestHelper::createContactWithAccountByNameForOwner('contact4', Yii::app()->user->userModel, $account2);
     $contact5 = ContactTestHelper::createContactWithAccountByNameForOwner('contact5', Yii::app()->user->userModel, $account2);
     $contact6 = ContactTestHelper::createContactWithAccountByNameForOwner('contact6', Yii::app()->user->userModel, $account2);
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact4);
     $member2 = MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList2, $contact5);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact6);
     static::$regularUserMarketingListId = $marketingList2->id;
     static::$regularUserMemberId = $member2->id;
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:31,代码来源:MarketingListDefaultPortletControllerRegularUserWalkthroughTest.php

示例9: makeAll

 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("User")');
     $gameRewards = array();
     $gameRewardRandomData = ZurmoRandomDataUtil::getRandomDataByModuleAndModelClassNames('GameRewardsModule', 'GameReward');
     for ($i = 0; $i < 10; $i++) {
         $gameReward = new GameReward();
         $gameReward->name = $gameRewardRandomData['names'][$i];
         $gameReward->owner = $demoDataHelper->getRandomByModelName('User');
         $gameReward->cost = mt_rand(1, 10);
         $gameReward->quantity = mt_rand(1, 20);
         for ($j = 0; $j < 5; $j++) {
             $gameRewardTransaction = new GameRewardTransaction();
             $gameRewardTransaction->person = $demoDataHelper->getRandomByModelName('User');
             $gameRewardTransaction->quantity = mt_rand(1, 3);
             $gameReward->transactions->add($gameRewardTransaction);
         }
         $gameReward->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
         $saved = $gameReward->save();
         if (!$saved) {
             throw new FailedToSaveModelException();
         }
         $gameReward = GameReward::getById($gameReward->id);
         AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($gameReward, Group::getByName(Group::EVERYONE_GROUP_NAME));
         $gameReward->save();
         $gameRewards[] = $gameReward->id;
     }
     $demoDataHelper->setRangeByModelName('GameReward', $gameRewards[0], $gameRewards[count($gameRewards) - 1]);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:GameRewardsDemoDataMaker.php

示例10: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     AllPermissionsOptimizationUtil::rebuild();
     //Add the nobody user to an account, but only read only.
     $nobody = User::getByUsername('nobody');
     $account = AccountTestHelper::createAccountByNameForOwner('superAccountReadableByNobody', Yii::app()->user->userModel);
     $account->addPermissions($nobody, Permission::READ, Permission::ALLOW);
     assert($account->save());
     // Not Coding Standard
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($account, $nobody);
     //Give the nobody user rights to the accounts module.
     $nobody->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $nobody->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
     assert($nobody->save());
     // Not Coding Standard
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     assert($everyoneGroup->save());
     // Not Coding Standard
     $group1 = new Group();
     $group1->name = 'Group1';
     assert($group1->save());
     // Not Coding Standard
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:27,代码来源:AccountPermissionsRegularUserWalkthroughTest.php

示例11: testCreateAndGetMissionById

 public function testCreateAndGetMissionById()
 {
     $super = User::getByUsername('super');
     $fileModel = ZurmoTestHelper::createFileModel();
     $steven = UserTestHelper::createBasicUser('steven');
     $steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
     $steven->save();
     $dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->dueDateTime = $dueStamp;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->files->add($fileModel);
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
     $this->assertTrue($mission->save());
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
     $id = $mission->id;
     $mission->forget();
     unset($mission);
     $mission = Mission::getById($id);
     $this->assertEquals('My test description', $mission->description);
     $this->assertEquals('My test reward', $mission->reward);
     $this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
     $this->assertEquals($super, $mission->owner);
     $this->assertEquals($steven, $mission->takenByUser);
     $this->assertEquals(1, $mission->files->count());
     $this->assertEquals($fileModel, $mission->files->offsetGet(0));
     $this->assertEquals($dueStamp, $mission->dueDateTime);
     $this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
     $this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:35,代码来源:MissionTest.php

示例12: actionRebuildMunge

 public function actionRebuildMunge()
 {
     AllPermissionsOptimizationUtil::rebuild();
     echo Zurmo::t('ZurmoModule', 'All permissions rebuild complete.') . "<BR>";
     if (SHOW_QUERY_DATA) {
         echo PageView::makeShowQueryDataContent();
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:8,代码来源:AllPermissionsController.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:8,代码来源:MarketingListDefaultControllerSuperUserWalkthroughTest.php

示例14: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     AllPermissionsOptimizationUtil::rebuild();
     $simpleUser = UserTestHelper::createBasicUser('simpleUser');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:AccountsRegularUserUnlinkWalkthroughTest.php

示例15: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     SecurityTestHelper::createSuperAdmin();
     //do the rebuild to ensure the tables get created properly.
     AllPermissionsOptimizationUtil::rebuild();
     //Manually build the test model munge tables.
     ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem'));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:OwnedSecurableTestItemTest.php


注:本文中的AllPermissionsOptimizationUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。