本文整理匯總了PHP中Group::isUserASuperAdministrator方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::isUserASuperAdministrator方法的具體用法?PHP Group::isUserASuperAdministrator怎麽用?PHP Group::isUserASuperAdministrator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::isUserASuperAdministrator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionCreateStuckJobNotification
/**
* This will send an email alert along with the notification.
* @throws NotSupportedException
*/
public function actionCreateStuckJobNotification()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
MonitorJob::makeJobStuckNotification(array('Process Outbound Email Job', 'Process Inbound Email Job'));
}
示例2: actionLoadContractsSampler
public function actionLoadContractsSampler()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
for ($i = 0; $i < 11; $i++) {
$owner = Yii::app()->user->userModel;
$name = 'Mass Delete ' . $i;
$currencies = Currency::getAll();
$currencyValue = new CurrencyValue();
$currencyValue->value = 500.54;
$currencyValue->currency = $currencies[0];
$contract = new Contract();
$contract->owner = $owner;
$contract->name = $name;
$contract->amount = $currencyValue;
$contract->closeDate = '2011-01-01';
//eventually fix to make correct format
$contract->stage->value = 'Negotiating';
$saved = $contract->save();
if (!$saved) {
throw new NotSupportedException();
}
}
}
示例3: actionLoadMassDeleteDemoData
public function actionLoadMassDeleteDemoData()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
UserInterfaceDevelopmentUtil::makeMassDeleteData();
}
示例4: actionUserInterface
public function actionUserInterface($type = null)
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
if ($type == null) {
$demoView = new MenuUserInterfaceDemoView();
$view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $demoView));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::STANDARD_VIEW) {
$demoView = new StandardUserInterfaceDemoView();
$demoView->message = 'Standard View';
$view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::STANDARD_BREADCRUMBS_VIEW) {
$breadCrumbLinks = array('Breadcrumb 1' => array('/zurmo/demo/userInterface'), 'Breadcrumb 2');
$demoView = new StandardUserInterfaceDemoView();
$demoView->message = 'Standard View with BreadCrumbs';
$view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $demoView, $breadCrumbLinks, 'SettingsBreadCrumbView'));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::GRACEFUL_ERROR_VIEW) {
$demoView = new StandardUserInterfaceDemoView();
$demoView->message = 'Graceful Error View';
$view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeErrorViewForCurrentUser($this, $demoView));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::UNEXPECTED_ERROR_VIEW) {
$view = new ErrorPageView('Unexpected error view');
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::AUTHORIZATION_VIEW) {
$demoView = new StandardUserInterfaceDemoView();
$demoView->message = 'Authorization View';
$view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeAuthorizationViewForCurrentUser($this, $demoView));
$view->setCssClasses(array_merge($view->getCssClasses(), array('ZurmoAuthorizationPageView')));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::CONTACT_FORM_EXTERNAL_VIEW) {
$containedView = new ContactExternalEditAndDetailsView('Edit', $this->getId(), $this->getModule()->getId(), new ContactWebFormsModelForm(new Contact()), ContactExternalEditAndDetailsView::getMetadata());
$view = new ContactWebFormsExternalPageView(ZurmoExternalViewUtil::makeExternalViewForCurrentUser($containedView));
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_EXTERNAL_PREVIEW_VIEW) {
$splashView = new MarketingListsExternalActionsPreviewView();
$view = new MarketingListsExternalActionsPageView($this, $splashView);
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_MANAGE_SUBSCRIPTIONS_VIEW) {
$marketingListMember = MarketingListMember::getSubset(null, 0, 1);
$marketingLists = MarketingList::getByUnsubscribedAndAnyoneCanSubscribe($marketingListMember[0]->contact->id);
$listView = new MarketingListsManageSubscriptionsListView($this->getId(), $this->getModule()->getId(), $marketingLists, -100, -100, -100, 'notUsed');
$view = new MarketingListsManageSubscriptionsPageView($this, $listView);
echo $view->render();
} elseif ($type == MenuUserInterfaceDemoView::MOBILE_HEADER_VIEW) {
Yii::app()->userInterface->setSelectedUserInterfaceType(UserInterface::MOBILE);
$demoView = new StandardUserInterfaceDemoView();
$demoView->message = 'Standard View';
$view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
echo $view->render();
} else {
throw new NotSupportedException();
}
}
示例5: actionReadMetadata
public function actionReadMetadata($className)
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
if (GlobalMetadata::isClassMetadataSavedInDatabase($className)) {
echo 'The metadata is saved in the database ' . "<BR>";
} else {
echo 'The metadata is not saved in the database ' . "<BR>";
}
echo "<pre>";
print_r($className::getMetadata());
echo "</pre>";
}
示例6: actionGenerateManageSubscriptionHash
/**
* Method for testing creating a simple notification for the current user.
*/
public function actionGenerateManageSubscriptionHash()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$personId = $contact->getClassId('Person');
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$marketingListId = $marketingList->id;
$model = RandomDataUtil::getRandomValueFromArray(CampaignItem::getAll());
$modelId = $model->id;
$modelType = get_class($model);
$hash = GlobalMarketingFooterUtil::resolveHash($personId, $marketingListId, $modelId, $modelType, false);
echo 'index.php/marketingLists/external/manageSubscriptions?hash=' . $hash;
}
示例7: actionLoadCollectionItems
public function actionLoadCollectionItems()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$collectionData = GameCollection::resolvePersonAndAvailableTypes(Yii::app()->user->userModel, GameCollection::getAvailableTypes());
foreach ($collectionData as $collection) {
$itemsData = $collection->getItemsData();
foreach ($itemsData as $type => $quantity) {
$itemsData[$type] = $quantity + 1;
}
$collection->setItemsData($itemsData);
$saved = $collection->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
}
}
示例8: actionLoadManyJobLogs
/**
* Special method to load up many job logs to view paginiation, modal, etc. in job log modal view
*/
public function actionLoadManyJobLogs()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
echo 'Creating jobs for CurrencyRatesUpdate' . "\n";
for ($i = 0; $i < 10; $i++) {
$jobLog = new JobLog();
$jobLog->type = 'CurrencyRatesUpdate';
$jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog->isProcessed = true;
$jobLog->message = 'A test message.';
$saved = $jobLog->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
}
}
示例9: actionLoadProductsSampler
/**
* Special method to load each type of product.
*/
public function actionLoadProductsSampler()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
//Create test account for product functional test on related list sorting, product related view.
$account = new Account();
$account->owner = Yii::app()->user->userModel;
$account->name = 'My Account For Product Test';
$saved = $account->save();
if (!$saved) {
throw new NotSupportedException();
}
//Load 6 so there is sufficient data for product related view pagination testing.
for ($i = 0; $i < 8; $i++) {
$product = new Product();
if ($i < 6) {
$product->name = 'Product with open stage ' . $i;
$product->stage->value = 'Open';
} elseif ($i == 6) {
$product->name = 'Product with lost stage ' . $i;
$product->stage->value = 'Lost';
} elseif ($i == 7) {
$product->name = 'Product with won stage ' . $i;
$product->stage->value = 'Won';
}
$product->owner = Yii::app()->user->userModel;
$product->quantity = mt_rand(1, 95);
$product->account = $account;
$product->type = 1;
$product->sellPrice->value = 786.0;
$product->sellPrice->currency->code = 'USD';
$product->priceFrequency = 2;
$saved = $product->save();
if (!$saved) {
throw new NotSupportedException();
}
}
}
示例10: actionLoadGameNotificationsSampler
/**
* Special method to load each type of game notification. New badge, badge grade change, and level up.
*/
public function actionLoadGameNotificationsSampler()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
//Level up notification
$gameNotification = new GameNotification();
$gameNotification->user = Yii::app()->user->userModel;
$gameNotification->setLevelChangeByNextLevelValue(2);
$saved = $gameNotification->save();
//New badge notification
$gameNotification = new GameNotification();
$gameNotification->user = Yii::app()->user->userModel;
$gameNotification->setNewBadgeByType('LoginUser');
$saved = $gameNotification->save();
//Badge grade up notification
$gameNotification = new GameNotification();
$gameNotification->user = Yii::app()->user->userModel;
$gameNotification->setBadgeGradeChangeByTypeAndNewGrade('LoginUser', 5);
$saved = $gameNotification->save();
echo "Demo data has been loaded. Go back to the application.";
}
示例11: actionLoadContactsSampler
/**
* Special method to load contacts for marketing functional test.
*/
public function actionLoadContactsSampler()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
//Load 12 contacts so there is sufficient data for marketing list pagination testing and mass delete.
for ($i = 1; $i <= 12; $i++) {
$firstName = 'Test';
$lastName = 'Contact';
$owner = Yii::app()->user->userModel;
$contact = new Contact();
$contact->firstName = $firstName;
$contact->lastName = $lastName . ' ' . $i;
$contact->owner = $owner;
$contact->state = ContactsUtil::getStartingState();
$saved = $contact->save();
assert('$saved');
if (!$saved) {
throw new NotSupportedException();
}
}
}
示例12: actionLoadWorkflowMessageInQueue
/**
* Special method to load ByTimeWorkflowInQueue models
*/
public function actionLoadWorkflowMessageInQueue()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$model = new Account();
$model->name = 'test account';
$saved = $model->save();
if (!$saved) {
throw new NotSupportedException();
}
$savedWorkflow = new SavedWorkflow();
$savedWorkflow->name = 'Test for demo Message Queue model';
$savedWorkflow->description = 'description';
$savedWorkflow->moduleClassName = 'AccountsModule';
$savedWorkflow->triggerOn = Workflow::TRIGGER_ON_NEW;
$savedWorkflow->type = Workflow::TYPE_BY_TIME;
$savedWorkflow->isActive = false;
$savedWorkflow->order = 1;
$savedWorkflow->serializedData = serialize(array(ComponentForWorkflowForm::TYPE_TRIGGERS => array(), ComponentForWorkflowForm::TYPE_ACTIONS => array(), ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES => array()));
$saved = $savedWorkflow->save();
if (!$saved) {
throw new NotSupportedException();
}
for ($i = 1; $i < 6; $i++) {
$workflowMessageInQueue = new WorkflowMessageInQueue();
$workflowMessageInQueue->processDateTime = '2014-03-0' . $i . ' 00:00:00';
$workflowMessageInQueue->savedWorkflow = $savedWorkflow;
$workflowMessageInQueue->modelClassName = get_class($model);
$workflowMessageInQueue->modelItem = $model;
$workflowMessageInQueue->serializedData = serialize(array());
$workflowMessageInQueue->triggeredByUser = Yii::app()->user->userModel;
$saved = $workflowMessageInQueue->save();
if (!$saved) {
throw new NotSupportedException();
}
}
}
示例13: actionCreateDemoImportForAnalysis
public function actionCreateDemoImportForAnalysis($firstRowIsHeaderRow = true)
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$import = new Import();
$serializedData['importRulesType'] = 'Accounts';
$mappingData = array('column_0' => array('attributeIndexOrDerivedType' => 'name', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_1' => array('attributeIndexOrDerivedType' => 'officePhone', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_2' => array('attributeIndexOrDerivedType' => 'officeFax', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_3' => array('attributeIndexOrDerivedType' => 'employees', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_4' => array('attributeIndexOrDerivedType' => 'annualRevenue', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_5' => array('attributeIndexOrDerivedType' => 'description', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_6' => array('attributeIndexOrDerivedType' => 'website', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_7' => array('attributeIndexOrDerivedType' => null, 'type' => 'importColumn', 'mappingRulesData' => array()));
$serializedData['mappingData'] = $mappingData;
$serializedData['rowColumnDelimiter'] = ',';
// Not Coding Standard
$serializedData['rowColumnEnclosure'] = '"';
$serializedData['firstRowIsHeaderRow'] = $firstRowIsHeaderRow;
$import->serializedData = serialize($serializedData);
$saved = $import->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
$this->createImportTempTable(8, $import->getTempTableName());
//Make header row
if ($firstRowIsHeaderRow) {
$newBean = ZurmoRedBean::dispense($import->getTempTableName());
$newBean->column_0 = 'Header #1';
$newBean->column_1 = 'Header #2';
$newBean->column_2 = 'Header #3';
$newBean->column_3 = 'Header #4';
$newBean->column_4 = 'Header #5';
$newBean->column_5 = 'Header #6';
$newBean->column_6 = 'Header #7';
$newBean->column_7 = 'Header #8';
ZurmoRedBean::store($newBean);
}
//Make data rows that are clean
for ($i = 0; $i < 3; $i++) {
$newBean = ZurmoRedBean::dispense($import->getTempTableName());
$newBean->column_0 = 'aa1' . $i;
$newBean->column_1 = 'aa2' . $i;
$newBean->column_2 = 'aa3' . $i;
$newBean->column_3 = 'aa4' . $i;
$newBean->column_4 = 'aa5' . $i;
$newBean->column_5 = 'aa6' . $i;
$newBean->column_6 = 'aa7' . $i;
$newBean->column_7 = 'aa8' . $i;
$newBean->analysisStatus = ImportDataAnalyzer::STATUS_CLEAN;
$analysisData = array();
$analysisData['column_0'] = array();
$analysisData['column_0'][] = 'a test message 1';
$analysisData['column_0'][] = 'a test message 2';
$analysisData['column_2'] = array();
$analysisData['column_2'][] = 'a test message 1';
$analysisData['column_2'][] = 'a test message 2';
$newBean->serializedAnalysisMessages = serialize($analysisData);
ZurmoRedBean::store($newBean);
}
//Make data rows that have a warning
for ($i = 0; $i < 3; $i++) {
$newBean = ZurmoRedBean::dispense($import->getTempTableName());
$newBean->column_0 = 'ba1' . $i;
$newBean->column_1 = 'ba2' . $i;
$newBean->column_2 = 'ba3' . $i;
$newBean->column_3 = 'ba4' . $i;
$newBean->column_4 = 'ba5' . $i;
$newBean->column_5 = 'ba6' . $i;
$newBean->column_6 = 'ba7' . $i;
$newBean->column_7 = 'ba8' . $i;
$newBean->analysisStatus = ImportDataAnalyzer::STATUS_WARN;
$analysisData = array();
$analysisData['column_0'] = array();
$analysisData['column_0'][] = 'a test message 1';
$analysisData['column_0'][] = 'a test message 2';
$analysisData['column_2'] = array();
$analysisData['column_2'][] = 'a test message 1';
$analysisData['column_2'][] = 'a test message 2';
$newBean->serializedAnalysisMessages = serialize($analysisData);
ZurmoRedBean::store($newBean);
}
//Make data rows that are skipped
for ($i = 0; $i < 10; $i++) {
$newBean = ZurmoRedBean::dispense($import->getTempTableName());
$newBean->column_0 = 'ca1' . $i;
$newBean->column_1 = 'ca2' . $i;
$newBean->column_2 = 'ca3' . $i;
$newBean->column_3 = 'ca4' . $i;
$newBean->column_4 = 'ca5' . $i;
$newBean->column_5 = 'ca6' . $i;
$newBean->column_6 = 'ca7' . $i;
$newBean->column_7 = 'ca8' . $i;
$newBean->analysisStatus = ImportDataAnalyzer::STATUS_SKIP;
$analysisData = array();
$analysisData['column_0'] = array();
$analysisData['column_0'][] = 'a test message 1';
$analysisData['column_0'][] = 'a test message 2';
$analysisData['column_2'] = array();
$analysisData['column_2'][] = 'a test message 1';
$analysisData['column_2'][] = 'a test message 2';
$newBean->serializedAnalysisMessages = serialize($analysisData);
ZurmoRedBean::store($newBean);
}
ZurmoRedBean::store($newBean);
echo 'the import id is: ' . $import->id;
//.........這裏部分代碼省略.........
示例14: actionSendDemoEmailNotifications
public function actionSendDemoEmailNotifications()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$template = "{message}<br/>";
$messageStreamer = new MessageStreamer($template);
$messageStreamer->setExtraRenderBytes(0);
$messageLogger = new MessageLogger($messageStreamer);
if (Yii::app()->user->userModel->primaryEmail->emailAddress == null) {
$messageLogger->addErrorMessage('Cannot send test emails because the current user does not have an email address');
Yii::app()->end(0, false);
}
$messageLogger->addInfoMessage('Using type:' . Yii::app()->emailHelper->outboundType);
$messageLogger->addInfoMessage('Using host:' . Yii::app()->emailHelper->outboundHost);
$messageLogger->addInfoMessage('Using port:' . Yii::app()->emailHelper->outboundPort);
$messageLogger->addInfoMessage('Using username:' . Yii::app()->emailHelper->outboundUsername);
if (Yii::app()->emailHelper->outboundPassword != null) {
$messageLogger->addInfoMessage('Using password: Yes');
} else {
$messageLogger->addInfoMessage('Using password: No');
}
$modules = Module::getModuleObjects();
foreach ($modules as $module) {
$notificationClassNames = $module::getAllClassNamesByPathFolder('data');
foreach ($notificationClassNames as $notificationClassName) {
if (!strpos($notificationClassName, 'DemoEmailNotifications') === false) {
$demoNotification = new $notificationClassName();
$demoNotification->run(Yii::app()->user->userModel, $messageLogger);
}
}
}
Yii::app()->emailHelper->sendQueued();
}
示例15: isSuperAdministrator
/**
* @return bool
* @throws NotSupportedException
*/
public function isSuperAdministrator()
{
if ($this->id < 0) {
throw new NotSupportedException();
}
return Group::isUserASuperAdministrator($this);
}