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


PHP ZurmoConfigurationUtil::setByUserAndModuleName方法代碼示例

本文整理匯總了PHP中ZurmoConfigurationUtil::setByUserAndModuleName方法的典型用法代碼示例。如果您正苦於以下問題:PHP ZurmoConfigurationUtil::setByUserAndModuleName方法的具體用法?PHP ZurmoConfigurationUtil::setByUserAndModuleName怎麽用?PHP ZurmoConfigurationUtil::setByUserAndModuleName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ZurmoConfigurationUtil的用法示例。


在下文中一共展示了ZurmoConfigurationUtil::setByUserAndModuleName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testListDefault

 public function testListDefault()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     ZurmoConfigurationUtil::setByUserAndModuleName($super, 'ZurmoModule', 'defaultPermissionSetting', null);
     ZurmoConfigurationUtil::setByUserAndModuleName($super, 'ZurmoModule', 'defaultPermissionGroupSetting', null);
     $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false));
     $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE);
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $response = $this->listDefaultPermissionsForCurrentUser($headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertArrayHasKey('data', $response);
     $this->assertCount(2, $response['data']);
     $this->assertArrayHasKey('owner', $response['data']);
     $this->assertCount(1, $response['data']['owner']);
     $this->assertArrayHasKey('id', $response['data']['owner']);
     $this->assertEquals($super->id, $response['data']['owner']['id']);
     $this->assertArrayHasKey('explicitReadWriteModelPermissions', $response['data']);
     $this->assertCount(2, $response['data']['explicitReadWriteModelPermissions']);
     $this->assertArrayHasKey('type', $response['data']['explicitReadWriteModelPermissions']);
     $this->assertEquals(1, $response['data']['explicitReadWriteModelPermissions']['type']);
     $this->assertArrayHasKey('nonEveryoneGroup', $response['data']['explicitReadWriteModelPermissions']);
     $this->assertEquals('', $response['data']['explicitReadWriteModelPermissions']['nonEveryoneGroup']);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:26,代碼來源:ApiRestPermissionTest.php

示例2: testGetAndSetByCurrentUserByModuleName

 public function testGetAndSetByCurrentUserByModuleName()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'aValue');
     Yii::app()->user->userModel = User::getByUsername('billy');
     $this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'bValue');
     Yii::app()->user->userModel = User::getByUsername('sally');
     $this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'cValue');
     //now retrieve again.
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->assertEquals('aValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     Yii::app()->user->userModel = User::getByUsername('billy');
     $this->assertEquals('bValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     Yii::app()->user->userModel = User::getByUsername('sally');
     $this->assertEquals('cValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
     //Test retrieving a generic value that is set globally on ZurmoModule. The value returned should be the
     //same for all users.
     $metadata = ZurmoModule::getMetadata();
     $this->assertTrue(!isset($metadata['global']['bKey']));
     $metadata['global']['bKey'] = 'GlobalValue';
     ZurmoModule::setMetadata($metadata);
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
     Yii::app()->user->userModel = User::getByUsername('billy');
     $this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
     Yii::app()->user->userModel = User::getByUsername('sally');
     $this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
     //Now change the bKey value, just for billy and retrieve again for all users. Only billy's bKey value
     //should be different.
     ZurmoConfigurationUtil::setByUserAndModuleName(User::getByUsername('billy'), 'ZurmoModule', 'bKey', 'BillyBKey');
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
     Yii::app()->user->userModel = User::getByUsername('billy');
     $this->assertEquals('BillyBKey', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
     Yii::app()->user->userModel = User::getByUsername('sally');
     $this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:40,代碼來源:ZurmoConfigurationUtilTest.php

示例3: setDefaultPermissionGroupSetting

 /**
  * @param User $user
  * @param int $value
  * @param int $defaultPermissionSetting
  */
 public static function setDefaultPermissionGroupSetting(User $user, $value, $defaultPermissionSetting)
 {
     assert('$value === null || is_int($value)');
     assert('$defaultPermissionSetting === null || is_int($defaultPermissionSetting)');
     if ($defaultPermissionSetting == UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP) {
         ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', 'defaultPermissionGroupSetting', $value);
     } else {
         ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', 'defaultPermissionGroupSetting', null);
     }
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:15,代碼來源:UserConfigurationFormAdapter.php

示例4: addMySubscribedCalendars

 /**
  * Add my subscribed calendars.
  * @param SavedCalendarSubscriptions $savedCalendarSubscriptions
  * @param User $user
  * @param string $subscribedCalendarIds
  * @return \SavedCalendarSubscriptions
  */
 private static function addMySubscribedCalendars(SavedCalendarSubscriptions $savedCalendarSubscriptions, User $user, $subscribedCalendarIds)
 {
     $mySubscribedCalendars = CalendarUtil::getUserSubscribedCalendars($user);
     if (count($mySubscribedCalendars) > 0) {
         ZurmoConfigurationUtil::setByUserAndModuleName($user, 'CalendarsModule', 'mySubscribedCalendarSelections', $subscribedCalendarIds);
         $subscribedCalendarIdArray = array();
         if ($subscribedCalendarIds != null) {
             $subscribedCalendarIdArray = explode(',', $subscribedCalendarIds);
             // Not Coding Standard
         }
         foreach ($mySubscribedCalendars as $key => $mySubscribedCalendar) {
             CalendarUtil::setSharedCalendarColor($mySubscribedCalendar);
             if (in_array($mySubscribedCalendar->id, $subscribedCalendarIdArray)) {
                 $savedCalendarSubscriptions->addSubscribedToCalendar($mySubscribedCalendar, true);
             } else {
                 $savedCalendarSubscriptions->addSubscribedToCalendar($mySubscribedCalendar, false);
             }
         }
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:27,代碼來源:SavedCalendarSubscriptions.php

示例5: setForCurrentUserByModuleName

 /**
  * For the current user, set a configuration value by module name and key.
  */
 public static function setForCurrentUserByModuleName($moduleName, $key, $value)
 {
     assert('is_string($moduleName)');
     assert('is_string($key)');
     assert('Yii::app()->user->userModel == null || Yii::app()->user->userModel->id > 0');
     if (!Yii::app()->user->userModel instanceof User) {
         return null;
     }
     ZurmoConfigurationUtil::setByUserAndModuleName(Yii::app()->user->userModel, $moduleName, $key, $value);
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:13,代碼來源:ZurmoConfigurationUtil.php

示例6: setByUserAndType

 /**
  * Set the pagination value for the specified user by pagination type.
  * @param $user - user model
  * @param $type - pagination type
  * @param $moduleName - optional. Module class name.
  */
 public function setByUserAndType($user, $type, $value, $moduleName = null)
 {
     assert('$user instanceOf User && $user->id > 0');
     assert('in_array($type, static::getAvailablePageSizeNames()) == true');
     assert('is_int($value) && $value > 0');
     assert('$moduleName == null || is_string($moduleName)');
     $keyName = $this->getKeyByTypeAndModuleName($type);
     ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', $keyName, $value);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:15,代碼來源:ZurmoPaginationHelper.php

示例7: setBackgroundTextureValue

 public function setBackgroundTextureValue(User $user, $value)
 {
     assert('is_string($value) || $value == null');
     ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', 'backgroundTexture', $value);
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:5,代碼來源:ThemeManager.php

示例8: processAndGetDataProviderForEventsData

 /**
  * Process and get data provider for events data.
  * @param null|string $myCalendarIds
  * @param null|string $mySubscribedCalendarIds
  * @param null|string $dateRangeType
  * @param null|string $startDate
  * @param null|string $endDate
  * @return CalendarItemsDataProvider
  */
 public static function processAndGetDataProviderForEventsData($selectedMyCalendarIds = null, $selectedSharedCalendarIds = null, $startDate = null, $endDate = null, $dateRangeType = null, $isSticky = true)
 {
     if ($isSticky) {
         ZurmoConfigurationUtil::setByUserAndModuleName(Yii::app()->user->userModel, 'CalendarsModule', 'myCalendarStartDate', $startDate);
         ZurmoConfigurationUtil::setByUserAndModuleName(Yii::app()->user->userModel, 'CalendarsModule', 'myCalendarEndDate', $endDate);
         ZurmoConfigurationUtil::setByUserAndModuleName(Yii::app()->user->userModel, 'CalendarsModule', 'myCalendarDateRangeType', $dateRangeType);
     }
     return CalendarUtil::processUserCalendarsAndMakeDataProviderForCombinedView($selectedMyCalendarIds, $selectedSharedCalendarIds, $dateRangeType, $startDate, $endDate);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:18,代碼來源:CalendarUtil.php

示例9: setSelectedTheme

 /**
  * @param $selectedTheme
  */
 public function setSelectedTheme($selectedTheme)
 {
     assert('is_string($selectedTheme) || $selectedTheme == null');
     $this->selectedTheme = $selectedTheme;
     $user = Yii::app()->user->userModel;
     $modelName = get_class($this->model);
     $key = $this->getSelectedThemeKeyByModelName($modelName);
     ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', $key, $selectedTheme);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:12,代碼來源:KanbanBoard.php

示例10: setValue

 public static function setValue(User $user, $value, $key, $saveBoolean = true)
 {
     assert('is_bool($saveBoolean)');
     assert('is_string($key)');
     $value = $saveBoolean ? (bool) $value : $value;
     ZurmoConfigurationUtil::setByUserAndModuleName($user, 'ZurmoModule', $key, $value);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:7,代碼來源:UserNotificationUtil.php


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