當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Installer::assignPermissions方法代碼示例

本文整理匯總了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
開發者ID:realslacker,項目名稱:Facts-Plugin,代碼行數:31,代碼來源:enable.php

示例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
	
}


開發者ID:realslacker,項目名稱:Banner-Plugin,代碼行數:28,代碼來源:enable.php

示例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
開發者ID:realslacker,項目名稱:Redirector-Plugin,代碼行數:31,代碼來源:enable.php

示例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.'));
		
	
}
開發者ID:realslacker,項目名稱:Downloads-Plugin,代碼行數:30,代碼來源:enable.php


注:本文中的Installer::assignPermissions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。