public static function resolveDefaultNotificationSettingsDefaultValuesByUser(User $user, &$defaultNotificationSettings) { if (UserConfigurationFormAdapter::resolveAndGetValue($user, 'turnOffEmailNotifications')) { foreach ($defaultNotificationSettings as $notificationName => $notificationSetting) { $defaultNotificationSettings[$notificationName]['email'] = false; } } }
protected function resolveSelectedGroup() { $resolvedSelectedGroup = parent::resolveSelectedGroup(); if ($resolvedSelectedGroup === null) { return UserConfigurationFormAdapter::resolveAndGetValue(Yii::app()->user->userModel, 'defaultPermissionGroupSetting', false); } return $resolvedSelectedGroup; }
public static function renderDesktopNotificationsScript() { if (UserConfigurationFormAdapter::resolveAndGetValue(Yii::app()->user->userModel, 'enableDesktopNotifications')) { $makeNotification = "\n if (window.webkitNotifications.checkPermission() == 0)\n {\n nf = window.webkitNotifications.createNotification(image, title, body);\n if (nf.hasOwnProperty('onshow'))\n {\n nf.onshow = function() {setTimeout(function () {nf.close();}, 20000);};\n }\n nf.show();\n return true;\n }\n "; } else { $makeNotification = ""; } // Begin Not Coding Standard $script = "\n var desktopNotifications =\n {\n notify:function(image, title, body)\n {\n " . $makeNotification . "\n return false;\n },\n isSupported:function()\n {\n if (typeof window.webkitNotifications != 'undefined')\n {\n return true\n }\n else\n {\n return false\n }\n },\n requestAutorization:function()\n {\n if (typeof window.webkitNotifications != 'undefined')\n {\n if (window.webkitNotifications.checkPermission() == 1)\n {\n window.webkitNotifications.requestPermission();\n }\n else if (window.webkitNotifications.checkPermission() == 2)\n {\n alert('" . Zurmo::t('ZurmoModule', 'You have blocked desktop notifications for this browser.') . "');\n }\n else\n {\n alert('" . Zurmo::t('ZurmoModule', 'You have already activated desktop notifications for Chrome') . "');\n }\n }\n else\n {\n alert('" . Zurmo::t('ZurmoModule', 'This is only available in Chrome.') . "');\n }\n }\n };\n "; // End Not Coding Standard Yii::app()->clientScript->registerScript('AutoUpdater', $script, CClientScript::POS_HEAD); }
public static function resolveUserDefaultPermissionsByUser(User $user, RedBeanModel $model = null) { $defaultPermissionSettings = UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($user); $nonEveryoneGroup = UserConfigurationFormAdapter::resolveAndGetValue($user, 'defaultPermissionGroupSetting', false); $type = DerivedExplicitReadWriteModelPermissionsElement::resolveUserPermissionConfigurationToPermissionType($defaultPermissionSettings); $explicitReadWriteModelPermissions = compact('type', 'nonEveryoneGroup'); $permissions = compact('explicitReadWriteModelPermissions'); if ($model === null || $model instanceof OwnedSecurableItem) { $owner = array('id' => $user->id); $permissions = compact('owner', 'explicitReadWriteModelPermissions'); } return $permissions; }
/** * @param RedBeanModel $relatedModel * @param Comment $comment * @param $senderPerson * @param array $peopleToSendNotification */ public static function sendNotificationOnNewComment(RedBeanModel $relatedModel, Comment $comment, $senderPerson, $peopleToSendNotification) { if (count($peopleToSendNotification) > 0) { foreach ($peopleToSendNotification as $people) { if ($people->primaryEmail->emailAddress !== null && !UserConfigurationFormAdapter::resolveAndGetValue($people, 'turnOffEmailNotifications')) { $subject = self::getEmailSubject($relatedModel); $content = self::getEmailContent($relatedModel, $comment, $people); EmailNotificationUtil::resolveAndSendEmail($senderPerson, array($people), $subject, $content); } } } else { return; } }
/** * @param SecurableItem $model * @param User $user * @throws NotSupportedException */ public static function updatePermissionsWithDefaultForModelByUser(SecurableItem $model, User $user) { if ($model instanceof SecurableItem && count($model->permissions) === 0) { $defaultPermission = UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($user); $nonEveryoneGroup = UserConfigurationFormAdapter::resolveAndGetValue($user, 'defaultPermissionGroupSetting', false); $type = static::resolveDefaultPermissionToExplicitReadWriteModelPermissionsUtilType($defaultPermission); $postData = array('explicitReadWriteModelPermissions' => compact('type', 'nonEveryoneGroup')); $explicitReadWritePermissions = self::resolveAndMakeExplicitReadWriteModelPermissions($postData, $model); $updated = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($model, $explicitReadWritePermissions); if (!$updated) { throw new NotSupportedException(); } } }
public function testUserCanSaveDefaultPermissions() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); $group = Group::getByName('testGroup2'); // set permission setting to 'everyone' and permission group settings to 'testGroup2' $this->setGetArray(array('id' => $super->id)); $postData = array('defaultPermissionSetting' => UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE, 'defaultPermissionGroupSetting' => $group->id); $this->setPostArray(array('UserConfigurationForm' => $postData)); $this->runControllerWithRedirectExceptionAndGetContent('users/default/configurationEdit', Yii::app()->createUrl('users/default/details', array('id' => $super->id))); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false)); // set permission setting to 'users and group', set permission group settings to 'testGroup2' $this->resetGetArray(); $this->resetPostArray(); $this->setGetArray(array('id' => $super->id)); $postData = array('defaultPermissionSetting' => UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP, 'defaultPermissionGroupSetting' => $group->id); $this->setPostArray(array('UserConfigurationForm' => $postData)); //Make sure the redirect is to the details view and not the list view. $this->runControllerWithRedirectExceptionAndGetContent('users/default/configurationEdit', Yii::app()->createUrl('users/default/details', array('id' => $super->id))); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false), $group->id); }
public function actionWelcome() { $hasDashboardAccess = true; if (!RightsUtil::doesUserHaveAllowByRightName('HomeModule', HomeModule::RIGHT_ACCESS_DASHBOARDS, Yii::app()->user->userModel)) { $hasDashboardAccess = false; } if ($this->hideWelcomeViewGlobally() || UserConfigurationFormAdapter::resolveAndGetValue(Yii::app()->user->userModel, 'hideWelcomeView')) { //If you can see dashboards, then go there, otherwise stay here since the user has limited access. if ($hasDashboardAccess) { $this->redirect(array($this->getId() . '/index')); } } else { $tipContent = ZurmoTipsUtil::getRandomTipResolvedForCurrentUser(); if (Yii::app()->userInterface->isMobile()) { $welcomeView = new MobileWelcomeView($tipContent, $hasDashboardAccess); } else { $welcomeView = new WelcomeView($tipContent, $hasDashboardAccess); } } $view = new HomePageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $welcomeView)); echo $view->render(); }
/** * @depends testListDefault */ public function testListDefaultAfterChange() { $super = User::getByUsername('super'); Yii::app()->user->userModel = $super; $authenticationData = $this->login(); $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST'); // change default permissions to a specific group, doesn't matter if it does not exist. $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($super); $form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP; $form->defaultPermissionGroupSetting = 6; UserConfigurationFormAdapter::setConfigurationFromForm($form, $super); unset($form); // validate that settings were saved. $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false), 6); $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(2, $response['data']['explicitReadWriteModelPermissions']['type']); $this->assertArrayHasKey('nonEveryoneGroup', $response['data']['explicitReadWriteModelPermissions']); $this->assertEquals(6, $response['data']['explicitReadWriteModelPermissions']['nonEveryoneGroup']); // change default permissions to owner only. $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($super); $form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER; UserConfigurationFormAdapter::setConfigurationFromForm($form, $super); unset($form); // validate that settings were saved. $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false)); $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('', $response['data']['explicitReadWriteModelPermissions']['type']); $this->assertArrayHasKey('nonEveryoneGroup', $response['data']['explicitReadWriteModelPermissions']); $this->assertEquals('', $response['data']['explicitReadWriteModelPermissions']['nonEveryoneGroup']); }
/** * Send task email * @param Notification $notification * @param TaskNotificationRules $rule * @param string $action */ protected static function sendTaskEmail(Notification $notification, TaskNotificationRules $rule, $action) { assert('is_string($action)'); if ($notification->owner->primaryEmail->emailAddress !== null && !UserConfigurationFormAdapter::resolveAndGetValue($notification->owner, 'turnOffEmailNotifications')) { $emailMessage = static::makeEmailMessage($notification, $rule, $action); $emailMessage->content = static::makeEmailContent($notification); $emailMessage->sender = static::makeSender(); $emailMessage->recipients->add(static::makeRecipient($notification)); $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME); $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT); try { Yii::app()->emailHelper->send($emailMessage); } catch (CException $e) { //Not sure what to do yet when catching an exception here. Currently ignoring gracefully. } } }
/** * @param Conversation $conversation * @param $person */ public static function sendEmailInviteToParticipant(Conversation $conversation, $person) { assert('$conversation->id > 0'); assert('$person instanceof User || $person instanceof Contact'); if ($person->primaryEmail->emailAddress !== null && ($person instanceof User && !UserConfigurationFormAdapter::resolveAndGetValue($person, 'turnOffEmailNotifications') || $person instanceof Contact)) { $userToSendMessagesFrom = $conversation->owner; $emailMessage = new EmailMessage(); $emailMessage->owner = Yii::app()->user->userModel; $emailMessage->subject = Zurmo::t('ConversationsModule', 'You have been invited to participate in a conversation'); $emailContent = new EmailMessageContent(); $emailContent->textContent = EmailNotificationUtil::resolveNotificationTextTemplate(static::getParticipantInviteEmailTextContent($conversation)); $emailContent->htmlContent = EmailNotificationUtil::resolveNotificationHtmlTemplate(static::getParticipantInviteEmailHtmlContent($conversation)); $emailMessage->content = $emailContent; $sender = new EmailMessageSender(); $sender->fromAddress = Yii::app()->emailHelper->resolveFromAddressByUser($userToSendMessagesFrom); $sender->fromName = strval($userToSendMessagesFrom); $sender->personOrAccount = $userToSendMessagesFrom; $emailMessage->sender = $sender; $recipient = new EmailMessageRecipient(); $recipient->toAddress = $person->primaryEmail->emailAddress; $recipient->toName = strval($person); $recipient->type = EmailMessageRecipient::TYPE_TO; $recipient->personOrAccount = $person; $emailMessage->recipients->add($recipient); $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME); $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT); try { Yii::app()->emailHelper->send($emailMessage); } catch (CException $e) { //Not sure what to do yet when catching an exception here. Currently ignoring gracefully. } } }
protected static function sendEmail(Notification $notification) { if ($notification->owner->primaryEmail->emailAddress !== null && !UserConfigurationFormAdapter::resolveAndGetValue($notification->owner, 'turnOffEmailNotifications')) { $userToSendMessagesFrom = BaseControlUserConfigUtil::getUserToRunAs(); $emailMessage = new EmailMessage(); $emailMessage->owner = Yii::app()->user->userModel; $emailMessage->subject = strval($notification); $emailContent = new EmailMessageContent(); $emailContent->textContent = EmailNotificationUtil::resolveNotificationTextTemplate($notification->notificationMessage->textContent); $emailContent->htmlContent = EmailNotificationUtil::resolveNotificationHtmlTemplate($notification->notificationMessage->htmlContent); $emailMessage->content = $emailContent; $sender = new EmailMessageSender(); $sender->fromAddress = Yii::app()->emailHelper->resolveFromAddressByUser($userToSendMessagesFrom); $sender->fromName = strval($userToSendMessagesFrom); $emailMessage->sender = $sender; $recipient = new EmailMessageRecipient(); $recipient->toAddress = $notification->owner->primaryEmail->emailAddress; $recipient->toName = strval($notification->owner); $recipient->type = EmailMessageRecipient::TYPE_TO; $recipient->personsOrAccounts->add($notification->owner); $emailMessage->recipients->add($recipient); $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME); $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT); if (!$emailMessage->save()) { throw new FailedToSaveModelException(); } try { Yii::app()->emailHelper->sendImmediately($emailMessage); } catch (CException $e) { //Not sure what to do yet when catching an exception here. Currently ignoring gracefully. } } }
public function testMakeFormAndSetConfigurationFromForm() { $billy = User::getByUsername('billy'); $sally = User::getByUsername('sally'); Yii::app()->pagination->setGlobalValueByType('listPageSize', 50); Yii::app()->pagination->setGlobalValueByType('subListPageSize', 51); Yii::app()->pagination->setGlobalValueByType('dashboardListPageSize', 52); //Confirm sally's configuration is the defaults. $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($sally); $this->assertEquals(50, $form->listPageSize); $this->assertEquals(51, $form->subListPageSize); $this->assertEquals(52, $form->dashboardListPageSize); $this->assertEquals('blue', Yii::app()->themeManager->resolveAndGetThemeColorValue($sally)); $this->assertEquals(null, Yii::app()->themeManager->resolveAndGetBackgroundTextureValue($sally)); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideWelcomeView')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'enableDesktopNotifications')); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'defaultPermissionGroupSetting', false)); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($sally), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideFromSelecting')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideFromLeaderboard')); $sally->hideFromLeaderboard = true; $sally->hideFromSelecting = true; $this->assertTrue($sally->save()); unset($sally); $sally = User::getByUsername('sally'); $this->assertTrue((bool) $sally->hideFromLeaderboard); $this->assertTrue((bool) $sally->hideFromSelecting); //Confirm billy's configuration is the defaults. $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy); $this->assertEquals(50, $form->listPageSize); $this->assertEquals(51, $form->subListPageSize); $this->assertEquals(52, $form->dashboardListPageSize); $this->assertEquals('blue', Yii::app()->themeManager->resolveAndGetThemeColorValue($billy)); $this->assertEquals(null, Yii::app()->themeManager->resolveAndGetBackgroundTextureValue($billy)); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'hideWelcomeView')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'enableDesktopNotifications')); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'defaultPermissionGroupSetting', false)); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($billy), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideFromSelecting')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideFromLeaderboard')); //Now change configuration for Billy. $form->listPageSize = 60; $form->subListPageSize = 61; $form->dashboardListPageSize = 62; $form->themeColor = 'lime'; $form->backgroundTexture = 'paper'; $form->hideWelcomeView = true; $form->enableDesktopNotifications = true; $form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP; $form->defaultPermissionGroupSetting = 6; $form->hideFromLeaderboard = true; $form->hideFromSelecting = true; UserConfigurationFormAdapter::setConfigurationFromForm($form, $billy); //Confirm billy's settings are changed correctly. $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy); $this->assertEquals(60, $form->listPageSize); $this->assertEquals(61, $form->subListPageSize); $this->assertEquals(62, $form->dashboardListPageSize); $this->assertEquals('lime', Yii::app()->themeManager->resolveAndGetThemeColorValue($billy)); $this->assertEquals('paper', Yii::app()->themeManager->resolveAndGetBackgroundTextureValue($billy)); $this->assertTrue(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'hideWelcomeView')); $this->assertTrue(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'enableDesktopNotifications')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideWelcomeView')); $this->assertFalse(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'enableDesktopNotifications')); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($billy), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'defaultPermissionGroupSetting', false), 6); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($sally), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'defaultPermissionGroupSetting', false)); $this->assertTrue((bool) $billy->hideFromLeaderboard); $this->assertTrue((bool) $billy->hideFromSelecting); //Now set configuration settings for sally and confirm they are correct. Yii::app()->user->userModel = $sally; UserConfigurationFormAdapter::setConfigurationFromFormForCurrentUser($form); $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($sally); $this->assertEquals(60, $form->listPageSize); $this->assertEquals(61, $form->subListPageSize); $this->assertEquals(62, $form->dashboardListPageSize); $this->assertEquals('lime', Yii::app()->themeManager->resolveAndGetThemeColorValue($sally)); $this->assertEquals('paper', Yii::app()->themeManager->resolveAndGetBackgroundTextureValue($sally)); $this->assertTrue(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'hideWelcomeView')); $this->assertTrue(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'enableDesktopNotifications')); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($sally), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetValue($sally, 'defaultPermissionGroupSetting', false), 6); $this->assertTrue((bool) $billy->hideFromLeaderboard); $this->assertTrue((bool) $billy->hideFromSelecting); //Now test that setting defaultPermissionSetting to owner makes the group settings null $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy); $form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER; $form->defaultPermissionGroupSetting = 4; UserConfigurationFormAdapter::setConfigurationFromForm($form, $billy); $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy); $this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($billy), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER); $this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($billy, 'defaultPermissionGroupSetting', false)); }
/** * Based on the model's attribute value being a explicitReadWriteModelPermissions object, * resolves the selected group value if available. * @return string */ protected function resolveSelectedGroup() { return UserConfigurationFormAdapter::resolveAndGetValue($this->model->user, 'defaultPermissionGroupSetting', false); }
/** * @param Mission $mission */ public static function makeAndSubmitNewMissionNotificationMessage(Mission $mission) { $recipients = array(); $peopleToSendNotification = static::resolvePeopleToSendNotificationToOnNewMission($mission); foreach ($peopleToSendNotification as $person) { if ($person->primaryEmail->emailAddress != null && !UserConfigurationFormAdapter::resolveAndGetValue($person, 'turnOffEmailNotifications')) { $recipients[] = $person; } } EmailNotificationUtil::resolveAndSendEmail($mission->owner, $recipients, static::getEmailSubject($mission), static::getEmailContent($mission)); }
/** * Based on the model's attribute value being a explicitReadWriteModelPermissions object, * resolves the selected group value if available. * @return string */ protected function resolveSelectedGroup() { if (!$this->isModelCreateAction() || $this->model->isCopied()) { return parent::resolveSelectedGroup(); } if (null != ($selectedGroup = UserConfigurationFormAdapter::resolveAndGetValue(Yii::app()->user->userModel, 'defaultPermissionGroupSetting', false))) { return $selectedGroup; } else { return parent::resolveSelectedGroup(); } }