当前位置: 首页>>代码示例>>PHP>>正文


PHP TaskPermission::addTask方法代码示例

本文整理汇总了PHP中TaskPermission::addTask方法的典型用法代码示例。如果您正苦于以下问题:PHP TaskPermission::addTask方法的具体用法?PHP TaskPermission::addTask怎么用?PHP TaskPermission::addTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskPermission的用法示例。


在下文中一共展示了TaskPermission::addTask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     Loader::model('single_page');
     $sp = Page::getByPath('/dashboard/settings/multilingual');
     if ($sp->isError()) {
         $d1a = SinglePage::add('/dashboard/settings/multilingual');
         $d1a->update(array('cName' => t('Multilingual Setup')));
     }
     $sp = Page::getByPath('/dashboard/composer');
     if ($sp->isError()) {
         $d2 = SinglePage::add('/dashboard/composer');
         $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.')));
     }
     $sp = Page::getByPath('/dashboard/composer/write');
     if ($sp->isError()) {
         $d3 = SinglePage::add('/dashboard/composer/write');
     }
     $sp = Page::getByPath('/dashboard/composer/drafts');
     if ($sp->isError()) {
         $d4 = SinglePage::add('/dashboard/composer/drafts');
     }
     $sp = Page::getByPath('/dashboard/pages/types/composer');
     if ($sp->isError()) {
         $d5 = SinglePage::add('/dashboard/pages/types/composer');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:35,代码来源:version_542.php

示例2: run

 public function run()
 {
     $db = Loader::db();
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISSYSTEMPAGE'])) {
         $db->Execute('alter table Pages add column cIsSystemPage tinyint(1) not null default 0');
         $db->Execute('alter table Pages add index (cIsSystemPage)');
     }
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISACTIVE'])) {
         $db->Execute('alter table Pages add column cIsActive tinyint(1) not null default 1');
         $db->Execute('alter table Pages add index (cIsActive)');
         $db->Execute('update Pages set cIsActive = 1');
     }
     $columns = $db->MetaColumns('PageSearchIndex');
     if (!isset($columns['CREQUIRESREINDEX'])) {
         $db->Execute('alter table PageSearchIndex add column cRequiresReindex tinyint(1) not null default 0');
         $db->Execute('alter table PageSearchIndex add index (cRequiresReindex)');
     }
     // install version job
     Loader::model("job");
     Job::installByHandle('remove_old_page_versions');
     // flag system pages appropriately
     Page::rescanSystemPages();
     // add a newsflow task permission
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('view_newsflow'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('view_newsflow', t('View Newsflow'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     // Install new block types
     $this->installBlockTypes();
     // install stacks, trash and drafts
     $this->installSinglePages();
     // move the old dashboard
     $newDashPage = Page::getByPath('/dashboard/welcome');
     if (!is_object($newDashPage) || $newDashPage->isError()) {
         $dashboard = Page::getByPath('/dashboard');
         $dashboard->moveToTrash();
         // install new dashboard + page types
         $this->installDashboard();
         $this->migrateOldDashboard();
     }
     Loader::model('system/captcha/library');
     $scl = SystemCaptchaLibrary::getByHandle('securimage');
     if (!is_object($scl)) {
         $scl = SystemCaptchaLibrary::add('securimage', t('SecurImage (Default)'));
         $scl->activate();
     }
     Config::save('SEEN_INTRODUCTION', 1);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:55,代码来源:version_550.php

示例3: run

 public function run()
 {
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('install_packages'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('install_packages', t('Install Packages and Connect to the Marketplace'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     // ensure we have a proper ocID
     $db->Execute("alter table Files modify column ocID int unsigned not null default 0");
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:14,代码来源:version_5411.php

示例4: installTaskPermissions

 protected function installTaskPermissions()
 {
     $g3 = Group::getByID(ADMIN_GROUP_ID);
     $tpo = TaskPermission::getByHandle('access_task_permissions');
     if (!is_object($tpo)) {
         $tp0 = TaskPermission::addTask('access_task_permissions', t('Change Task Permissions'), false);
         $tp1 = TaskPermission::addTask('access_sitemap', t('Access Sitemap and Page Search'), false);
         $tp2 = TaskPermission::addTask('access_user_search', t('Access User Search'), false);
         $tp3 = TaskPermission::addTask('access_group_search', t('Access Group Search'), false);
         $tp4 = TaskPermission::addTask('access_page_defaults', t('Change Content on Page Type Default Pages'), false);
         $tp5 = TaskPermission::addTask('backup', t('Perform Full Database Backups'), false);
         $tp6 = TaskPermission::addTask('sudo', t('Sign in as User'), false);
         $tp7 = TaskPermission::addTask('uninstall_packages', t('Uninstall Packages'), false);
         $tp1->addAccess($g3);
         $tp2->addAccess($g3);
         $tp3->addAccess($g3);
         $tp5->addAccess($g3);
     }
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:19,代码来源:version_540.php

示例5: importTaskPermissions

 protected function importTaskPermissions(\SimpleXMLElement $sx)
 {
     if (isset($sx->taskpermissions)) {
         foreach ($sx->taskpermissions->taskpermission as $tp) {
             $pkg = static::getPackageObject($tp['package']);
             $tpa = TaskPermission::addTask($tp['handle'], $tp['name'], $tp['description'], $pkg);
             if (isset($tp->access)) {
                 foreach ($tp->access->children() as $ch) {
                     if ($ch->getName() == 'group') {
                         $g = Group::getByName($ch['name']);
                         if (!is_object($g)) {
                             $g = Group::add($ch['name'], $ch['description']);
                         }
                         $tpa->addAccess($g);
                     }
                 }
             }
         }
     }
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:20,代码来源:ContentImporter.php


注:本文中的TaskPermission::addTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。