本文整理汇总了PHP中Installer::assignPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::assignPermissions方法的具体用法?PHP Installer::assignPermissions怎么用?PHP Installer::assignPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::assignPermissions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
SQL;
if ( ! Installer::createTable($facts_table,$facts_table_sql) ) Installer::failInstall( 'facts', __('Could not create table 1 of 1.') );
// create new permissions
if ( ! Installer::createPermissions('facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
// create new roles
if ( ! Installer::createRoles('facts admin,facts editor,facts user') ) Installer::failInstall( 'facts' );
// assign permissions
// note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
if ( ! Installer::assignPermissions('administrator','facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
if ( ! Installer::assignPermissions('editor','facts_view') ) Installer::failInstall( 'facts' );
if ( ! Installer::assignPermissions('facts admin','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
if ( ! Installer::assignPermissions('facts editor','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
if ( ! Installer::assignPermissions('facts user','admin_view,facts_view') ) Installer::failInstall( 'facts' );
// setup plugin settings
$settings = array(
'version' => '0.0.2'
);
if ( ! Plugin::setAllSettings($settings, 'facts') ) Installer::failInstall( 'facts', __('Unable to store plugin settings!') );
Flash::set('success', __('Successfully installed Facts plugin.'));
// we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
break;
// upgrade 0.0.2 to 0.0.3
case '0.0.2':
// nothing here because we're still on 0.0.2, if we were on 0.0.1 and this was 0.0.3 upgrades would process in order
示例2: __
'dirmode' => '0775',
'target' => '_blank'
);
if ( ! Plugin::setAllSettings($settings, 'banner') ) Installer::failInstall( 'banner', __('Unable to store plugin settings!') );
Flash::set('success', __('Successfully installed Banner plugin.'));
// we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
break;
// upgrade 0.0.1 to 0.0.2
case '0.0.1':
if ( ! Installer::createRoles('banner admin,banner manager') ) Installer::failInstall('banner');
if ( ! Installer::assignPermissions('banner admin','admin_view,banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner');
if ( ! Installer::assignPermissions('banner manager','admin_view,banner_view,banner_new,banner_edit,banner_delete') ) Installer::failInstall('banner');
$settings = array('version' => '0.0.2');
if ( ! Plugin::setAllSettings($settings, 'banner') ) Installer::failInstall( 'banner', __('Unable to store plugin settings!') );
Flash::set('success', __('Successfully upgraded Banner plugin.'));
// upgrade 0.0.2 to 0.0.3
case '0.0.2':
// nothing here because we're still on 0.0.2, if we were on 0.0.1 and this was 0.0.3 upgrades would process in order
}
示例3: array
SQL;
$sql = $driver == 'mysql' ? $errors_table_mysql : $errors_table_sqlite ;
if ( ! Installer::query($sql) ) Installer::failInstall( 'redirector', __('Could not alter table 2 of 2.') );
// create new permissions
if ( ! Installer::createPermissions('redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
// create new roles
if ( ! Installer::createRoles('redirector admin,redirector editor,redirector user') ) Installer::failInstall( 'redirector' );
// assign permissions
// note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
if ( ! Installer::assignPermissions('administrator','redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
if ( ! Installer::assignPermissions('editor','redirector_view') ) Installer::failInstall( 'redirector' );
if ( ! Installer::assignPermissions('redirector admin','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
if ( ! Installer::assignPermissions('redirector editor','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete') ) Installer::failInstall( 'redirector' );
if ( ! Installer::assignPermissions('redirector user','admin_view,redirector_view') ) Installer::failInstall( 'redirector' );
// setup plugin settings
$settings = array(
'version' => '0.2.5',
'threshold' => '10',
'expireafter' => '365'
);
if ( ! Plugin::setAllSettings($settings, 'redirector') ) Installer::failInstall( 'redirector', __('Unable to store plugin settings!') );
Flash::set( 'success', __('Successfully upgraded Redirector plugin.') );
break;
}
// EOF
示例4: __
Flash::set('success', __('Successfully installed Download Manager plugin.'));
// we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
break;
// upgrade 0.0.1 to 0.0.2
case '0.0.1':
$settings = array('version' => '0.0.2');
if ( ! Plugin::setAllSettings($settings, 'downloads') ) Installer::failInstall( 'downloads', __('Unable to store plugin settings!') );
// upgrade 0.0.2 to 0.0.3
case '0.0.2':
// create new roles
if ( ! Installer::createRoles('download manager user') ) Installer::failInstall('downloads');
// assign permissions
// note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
if ( ! Installer::assignPermissions('download manager user','admin_view,downloads_view') ) Installer::failInstall('downloads');
$settings = array('version' => '0.0.3');
if ( ! Plugin::setAllSettings($settings, 'downloads') ) Installer::failInstall( 'downloads', __('Unable to store plugin settings!') );
// this line should come after all upgrade cases so that it's only set once
Flash::set('success', __('Successfully upgraded Download Manager plugin.'));
}