本文整理汇总了PHP中ReadPermissionsOptimizationUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ReadPermissionsOptimizationUtil类的具体用法?PHP ReadPermissionsOptimizationUtil怎么用?PHP ReadPermissionsOptimizationUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReadPermissionsOptimizationUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: makeBuilderPredefinedEmailTemplate
protected function makeBuilderPredefinedEmailTemplate($name, $unserializedData, $subject = null, $modelClassName = null, $language = null, $type = null, $isDraft = 0, $textContent = null, $htmlContent = null)
{
$emailTemplate = new EmailTemplate();
$emailTemplate->type = $type;
//EmailTemplate::TYPE_WORKFLOW;
$emailTemplate->builtType = EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE;
$emailTemplate->isDraft = $isDraft;
$emailTemplate->modelClassName = $modelClassName;
$emailTemplate->name = $name;
if (empty($subject)) {
$subject = $name;
}
$emailTemplate->subject = $subject;
if (!isset($language)) {
$language = Yii::app()->languageHelper->getForCurrentUser();
}
$emailTemplate->language = $language;
$emailTemplate->htmlContent = $htmlContent;
$emailTemplate->textContent = $textContent;
$emailTemplate->serializedData = CJSON::encode($unserializedData);
$emailTemplate->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
$saved = $emailTemplate->save(false);
if (!$saved) {
throw new FailedToSaveModelException();
}
$emailTemplate = EmailTemplate::getById($emailTemplate->id);
ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($emailTemplate, Group::getByName(Group::EVERYONE_GROUP_NAME));
$saved = $emailTemplate->save(false);
assert('$saved');
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:EmailTemplatesBaseDefaultDataMaker.php
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
ReadPermissionsOptimizationUtil::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
ReadPermissionsOptimizationUtil::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:youprofit,项目名称:Zurmo,代码行数:27,代码来源:AccountPermissionsRegularUserWalkthroughTest.php
示例3: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
$super = User::getByUsername('super');
$super->primaryEmail->emailAddress = '[email protected]';
$saved = $super->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
MarketingListTestHelper::createMarketingListByName('testMarketingList');
$campaign = CampaignTestHelper::createCampaign('testCampaign', 'testSubject', 'testContent');
$contact = ContactTestHelper::createContactByNameForOwner('test', $super);
$emailMessage = EmailMessageTestHelper::createArchivedUnmatchedSentMessage($super);
$campaignItem = new CampaignItem();
$campaignItem->contact = $contact;
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->emailMessage = $emailMessage;
$campaignItem->unrestrictedSave();
if (!$saved) {
throw new FailedToSaveModelException();
}
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:26,代码来源:CampaignItemSummaryListViewColumnAdapterTest.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);
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:26,代码来源:MarketingListDefaultPortletControllerSuperUserWalkthroughTest.php
示例5: 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;
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:31,代码来源:MarketingListDefaultPortletControllerRegularUserWalkthroughTest.php
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createRoles();
RedBeanModel::forgetAll();
//do the rebuild to ensure the tables get created properly.
ReadPermissionsOptimizationUtil::rebuild();
//Manually build the test model munge tables.
ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem'));
ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem2'));
$benny = User::getByUsername('benny');
$model = new OwnedSecurableTestItem();
$model->member = 'test';
assert($model->save());
// Not Coding Standard
$model = new OwnedSecurableTestItem();
$model->member = 'test2';
assert($model->save());
// Not Coding Standard
$model = new OwnedSecurableTestItem();
$model->member = 'test3';
$model->owner = $benny;
assert($model->save());
// Not Coding Standard
assert(OwnedSecurableTestItem::getCount() == 3);
// Not Coding Standard
$model = new OwnedSecurableTestItem2();
$model->member = 'test5';
assert($model->save());
// Not Coding Standard
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:35,代码来源:OwnedSecurableItemReadPermissionOptimizationTest.php
示例7: setMembershipFromForm
/**
* Takes post data and prepares it for setting the membership on the group.
* Adds and removes users to group based on a form's userMembershipData
* @return boolean. True if membership was set successfully.
*/
public static function setMembershipFromForm($form, $group)
{
assert('$group instanceof Group');
assert('$form instanceof GroupUserMembershipForm');
$removedUsers = array();
$addedUsers = array();
foreach ($group->users as $index => $user) {
if (empty($form->userMembershipData[$user->id])) {
$group->users->removeByIndex($index);
$removedUsers[] = $user;
}
}
$users = GroupUserMembershipFormUtil::makeUsersFromUserMembershipData($form->userMembershipData);
foreach ($users as $user) {
if (!$group->users->contains($user)) {
$group->users->add($user);
$addedUsers[] = $user;
}
}
$group->save();
foreach ($removedUsers as $user) {
ReadPermissionsOptimizationUtil::userRemovedFromGroup($group, $user);
}
foreach ($addedUsers as $user) {
ReadPermissionsOptimizationUtil::userAddedToGroup($group, $user);
}
return true;
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:33,代码来源:GroupUserMembershipFormUtil.php
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
ReadPermissionsOptimizationUtil::rebuild();
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:7,代码来源:EmailArchivingUtilTest.php
示例9: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
ReadPermissionsOptimizationUtil::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 = '[email protected]';
$contact->secondaryEmail->emailAddress = '[email protected]';
$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 = '[email protected]';
$molly->secondaryEmail->emailAddress = '[email protected]';
$contact->save();
ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($contact, $billy);
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:28,代码来源:EmailMessageUtilTest.php
示例10: makeAll
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);
$saved = $mission->save();
assert('$saved');
$mission = Mission::getById($mission->id);
ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, Group::getByName(Group::EVERYONE_GROUP_NAME));
$mission->save();
$missions[] = $mission->id;
}
$demoDataHelper->setRangeByModelName('Mission', $missions[0], $missions[count($missions) - 1]);
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:32,代码来源:MissionsDemoDataMaker.php
示例11: 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);
}
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:26,代码来源:MarketingListMemberControllerRegularUserWalkthroughTest.php
示例12: actionRebuildMunge
public function actionRebuildMunge()
{
ReadPermissionsOptimizationUtil::rebuild();
echo Zurmo::t('ZurmoModule', 'Read permissions rebuild complete.') . "<BR>";
if (SHOW_QUERY_DATA) {
echo PageView::makeShowQueryDataContent();
}
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:ReadPermissionsController.php
示例13: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// Setup test data owned by the super user.
static::$templateOwnedBySuper = EmailTemplateTestHelper::create('Test Name1', 'Test Subject1', 'Contact', 'Test HtmlContent1', 'Test TextContent1');
UserTestHelper::createBasicUser('nobody');
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:EmailTemplatesRegularUserWalkthroughTest.php
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:EmailTemplatesSuperUserWalkthroughTest.php
示例15: 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.
ReadPermissionsOptimizationUtil::rebuild();
$simpleUser = UserTestHelper::createBasicUser('simpleUser');
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:AccountsRegularUserUnlinkWalkthroughTest.php
示例16: testGetMungeIdsByUserIncludesEveryoneGroup
public function testGetMungeIdsByUserIncludesEveryoneGroup()
{
Yii::app()->user->userModel = User::getByUsername('super');
$mungeIds = ReadPermissionsOptimizationUtil::getMungeIdsByUser(Yii::app()->user->userModel);
$this->assertEquals(2, count($mungeIds));
$group = Group::getByName(Group::EVERYONE_GROUP_NAME);
$group->save();
$mungeIds = ReadPermissionsOptimizationUtil::getMungeIdsByUser(Yii::app()->user->userModel);
$this->assertEquals(3, count($mungeIds));
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:ReadPermissionsOptimizationUtilTest.php
示例17: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
self::$asynchronusThreshold = ExportModule::$asynchronusThreshold;
ExportModule::$asynchronusThreshold = 5;
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:10,代码来源:UsersRegularUserExportWalkthroughTest.php
示例18: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
UserTestHelper::createBasicUser('nobody');
static::$listOwnedBySuper = MarketingListTestHelper::createMarketingListByName('MarketingListName', 'MarketingList Description');
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:MarketingListDefaultControllerRegularUserWalkthroughTest.php
示例19: 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
示例20: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
MarketingListTestHelper::createMarketingListByName('MarketingListName', 'MarketingList Description', 'first', '[email protected]');
MarketingListTestHelper::createMarketingListByName('MarketingListName2', 'MarketingList Description2', 'second', '[email protected]');
ReadPermissionsOptimizationUtil::rebuild();
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:10,代码来源:MarketingListDefaultControllerSuperUserWalkthroughTest.php
注:本文中的ReadPermissionsOptimizationUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论