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


PHP Installer::createPermissions方法代碼示例

本文整理匯總了PHP中Installer::createPermissions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Installer::createPermissions方法的具體用法?PHP Installer::createPermissions怎麽用?PHP Installer::createPermissions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Installer的用法示例。


在下文中一共展示了Installer::createPermissions方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: INT

		$facts_table_sql =<<<SQL
			CREATE TABLE IF NOT EXISTS {$facts_table}  (
				`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
				`name` VARCHAR( 255 ) NULL DEFAULT NULL ,
				`data` MEDIUMTEXT NULL DEFAULT NULL ,
				`url` VARCHAR( 255 ) NULL DEFAULT NULL ,
				`clicks` INT( 11 ) NOT NULL DEFAULT '0' ,
				`created` DATETIME NULL DEFAULT NULL ,
				`updated` DATETIME NULL DEFAULT NULL ,
				PRIMARY KEY ( `id` )
			) ENGINE=MYISAM DEFAULT CHARSET=utf8
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'
開發者ID:realslacker,項目名稱:Facts-Plugin,代碼行數:31,代碼來源:enable.php

示例2: VARCHAR

				`target` VARCHAR( 25 ) NULL DEFAULT NULL ,
				`width` VARCHAR( 5 ) NULL DEFAULT NULL ,
				`height` VARCHAR( 5 ) NULL DEFAULT NULL ,
				`dcount` int(11) NOT NULL DEFAULT 0,
				`ccount` int(11) NOT NULL DEFAULT 0,
				`active` tinyint(1) NOT NULL DEFAULT 1,
				`created` DATETIME NULL DEFAULT NULL ,
				`expires` DATE NULL DEFAULT NULL,
				`updated` DATETIME NULL DEFAULT NULL,
				PRIMARY KEY ( `id` )
			) ENGINE=MyISAM  DEFAULT CHARSET=utf8
SQL;
		if ( ! Installer::createTable($banner_table,$banner_table_sql) ) Installer::failInstall( 'banner', __('Could not create table 1 of 1.') );
		
		//	create new permissions
		if ( ! Installer::createPermissions('banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner');
		
		//	create new roles
		if ( ! Installer::createRoles('banner admin,banner manager') ) Installer::failInstall('banner');
		
		//	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('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');
		if ( ! Installer::assignPermissions('administrator','banner_view,banner_new,banner_edit,banner_delete,banner_settings') ) Installer::failInstall('banner');
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.0.2',
			'imgpath'		=>	'public/banners',
			'imguri'		=>	'public/banners',
開發者ID:realslacker,項目名稱:Banner-Plugin,代碼行數:31,代碼來源:enable.php

示例3: VARCHAR

				`id` INTEGER PRIMARY KEY AUTOINCREMENT ,
				`url` VARCHAR( 255 ) ,
				`hits` INT( 11 ) DEFAULT 0 NOT NULL ,
				`created` DATETIME DEFAULT NULL ,
				`updated` DATETIME DEFAULT NULL
			);
			INSERT INTO `{$errors_table}` ( `url`, `hits`, `created`, `updated` )
				SELECT `url`, `hits`, `created_on`, `created_on`
				FROM `{$errors_table}_old`;
			DROP TABLE `{$errors_table}_old`;
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',
開發者ID:realslacker,項目名稱:Redirector-Plugin,代碼行數:31,代碼來源:enable.php

示例4: INT

			) ENGINE=MYISAM DEFAULT CHARSET=utf8
SQL;
		if ( ! Installer::createTable($downloadtags_table,$downloadtags_table_sql) ) Installer::failInstall( 'downloads', __('Could not create table 2 of 3.') );
		
		$downloads_tags_table = TABLE_PREFIX.'downloads_tags';
		$downloads_tags_table_sql =<<<SQL
			CREATE TABLE IF NOT EXISTS {$downloads_tags_table}  (
				`download_id` INT( 11 ) NOT NULL ,
				`tag_id` INT( 11 ) NOT NULL,
				INDEX `download_tag` ( `download_id` , `tag_id` )
			) ENGINE=MYISAM DEFAULT CHARSET=utf8
SQL;
		if ( ! Installer::createTable($downloads_tags_table,$downloads_tags_table_sql) ) Installer::failInstall( 'downloads', __('Could not create table 3 of 3.') );
		
		//	create new permissions
		if ( ! Installer::createPermissions('downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads');
		
		//	create new roles
		if ( ! Installer::createRoles('download manager admin,download manager editor,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 admin','admin_view,downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads');
		if ( ! Installer::assignPermissions('download manager editor','admin_view,downloads_view,downloads_new,downloads_edit,downloads_delete') ) Installer::failInstall('downloads');
		if ( ! Installer::assignPermissions('download manager user','admin_view,downloads_view') ) Installer::failInstall('downloads');
		if ( ! Installer::assignPermissions('administrator','downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings') ) Installer::failInstall('downloads');
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.0.3',
			'download_path'	=>	'public/downloads',
開發者ID:realslacker,項目名稱:Downloads-Plugin,代碼行數:31,代碼來源:enable.php


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