当前位置: 首页>>代码示例>>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;未经允许,请勿转载。