本文整理汇总了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');
}
}
示例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);
}
示例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");
}
示例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);
}
}
示例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);
}
}
}
}
}
}