コード例 #1
0
 public function action_plugin_deactivation($file)
 {
     if ($file == str_replace('\\', '/', $this->get_file())) {
         # delete default access token
         ACL::destroy_token('manage_cronjobs');
     }
 }
コード例 #2
0
ファイル: pbem.plugin.php プロジェクト: habari-extras/pbem
 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         CronTab::delete_cronjob('pbem_check_accounts');
         ACL::destroy_token('PBEM');
     }
 }
コード例 #3
0
ファイル: hpm.plugin.php プロジェクト: habari-extras/hpm
 public function action_plugin_deactivation($file)
 {
     # delete default access tokens for: 'system', 'plugin', 'theme', 'class'
     ACL::destroy_token('install_new_system');
     ACL::destroy_token('install_new_plugin');
     ACL::destroy_token('install_new_theme');
     ACL::destroy_token('install_new_class');
 }
コード例 #4
0
	/**
	*
	* @param string $file. The name of the plugin file
	*
	* Delete the special silo permissions if they're no longer
	* being used.
	*/
	public function action_plugin_deactivation( $file ) {
		$silos = Plugins::get_by_interface( 'MediaSilo' );
		if ( count( $silos ) <= 1 ) {
			ACL::destroy_token( 'upload_media' );
			ACL::destroy_token( 'delete_media' );
			ACL::destroy_token( 'create_directories' );
			ACL::destroy_token( 'delete_directories' );
		}
	}
コード例 #5
0
ファイル: test_acl.php プロジェクト: habari/tests
 public function test_user_permissions()
 {
     ACL::create_token('acltest', 'A test ACL permission', 'Administration');
     $this->acl_user_alice->grant('acltest', 'full');
     $this->assert_true($this->acl_user_alice->can('acltest', 'full'), 'Could not grant acltest permission to user.');
     $this->acl_user_alice->revoke('acltest');
     // check that members of a group inherit that group's permissions
     $this->acl_group->grant('acltest', 'full');
     $this->assert_true($this->acl_user_alice->can('acltest', 'full'), 'User did not inherit group permissions.');
     ACL::destroy_token('acltest');
 }
コード例 #6
0
 public function action_plugin_deactivation($file = '')
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         ACL::destroy_token('snapshot');
         // wipe out the default options we added
         Options::delete('exportsnapshot__frequency');
         Options::delete('exportsnapshot__type');
         // remove the module
         Modules::remove_by_name(_t('Snapshots', 'exportsnapshot'));
         // @todo what about the snapshots option and deleting those cached items?
         // probably an uninstall method too?
     }
 }
コード例 #7
0
 /**
  * Remove the admin token
  **/
 public function action_plugin_deactivation($file)
 {
     // delete default access token
     ACL::destroy_token('manage_menus');
     // delete menu vocabularies that were created
     $vocabs = DB::get_results('SELECT * FROM {vocabularies} WHERE name LIKE "menu_%"', array(), 'Vocabulary');
     foreach ($vocabs as $vocab) {
         // This should only delete the ones that are menu vocabularies, unless others have been named 'menu_xxxxx'
         $vocab->delete();
     }
     // delete blocks that were created
     $blocks = DB::get_results('SELECT * FROM {blocks} WHERE type = "menu"', array(), 'Block');
     foreach ($blocks as $block) {
         $block->delete();
     }
 }
コード例 #8
0
ファイル: post.php プロジェクト: rynodivino/system
	/**
	 * removes a post type from the database, if it exists and there are no posts
	 * of the type
	 * @param string The post type name
	 * @return boolean
	 *   true if post type has been deleted
	 *   false if it has not been deleted (does not exist or there are posts using
	 *   this content type)
	 */
	public static function delete_post_type( $type )
	{
		// refresh the cache from the DB, just to be sure
		$types = self::list_all_post_types( true );

		if ( array_key_exists( $type, $types ) ) {

			// Exists in DB.. check if there are content with this type.
			if ( ! DB::exists( '{posts}', array( 'content_type' => Post::type( $type ) ) ) ) {

				// Finally, remove from database and destroy tokens
				DB::delete( '{posttype}', array( 'name' => $type ) );
				ACL::destroy_token( 'post_' . Utils::slugify( $type ) );

				// now force a refresh of the caches, so the removed type is no longer
				// available for use
				$types = self::list_active_post_types( true );
				$types = self::list_all_post_types( true );

				return true;
			}
		}

		return false;
	}
コード例 #9
0
 /**
  *  Action: plugin deactivation 
  *
  * Cleans up after this plugin when deactivated, including:
  *
  * - Removes ACL token
  * - Removes plugin options
  *
  * @return void
  */
 public function action_plugin_deactivation($file)
 {
     if ($file == str_replace('\\', '/', $this->get_file())) {
         ACL::destroy_token('manage_options');
     }
     Options::delete($this->class_name . '__allow_delete_core');
     Options::delete($this->class_name . '__allow_delete_other');
 }
コード例 #10
0
 public function action_plugin_deactivation($file)
 {
     if ($file == str_replace('\\', '/', $this->get_file())) {
         ACL::destroy_token(self::PLUGIN_TOKEN);
     }
 }
コード例 #11
0
 /**
  * Hook on deactivation of this plugin
  */
 public function action_plugin_deactivation()
 {
     // when deactivating, don't destroy data, just turn it 'off'
     Post::deactivate_post_type('addon');
     ACL::destroy_token('manage_versions');
 }
コード例 #12
0
 /**
  * Set up needed permissions
  */
 private static function uninstall()
 {
     // Deactivate post types
     Post::deactivate_post_type('thread');
     Post::deactivate_post_type('forum');
     // Remove tokens
     ACL::destroy_token('forum_close_thread');
     ACL::destroy_token('forum_see_private');
 }
コード例 #13
0
 public function action_plugin_deactivation($plugin_file)
 {
     if (Plugins::id_from_file(__FILE__) == Plugins::id_from_file($plugin_file)) {
         ACL::destroy_token('private');
     }
 }
コード例 #14
0
 /**
  * remove ACL tokens when this plugin is deactivated
  **/
 function action_plugin_deactivation($plugin_file)
 {
     ACL::destroy_token('Rewriter');
 }
コード例 #15
0
ファイル: test_usergroup.php プロジェクト: habari/tests
 public function teardown_acl()
 {
     ACL::destroy_token('test permission');
     ACL::destroy_token('test deny permission');
 }
コード例 #16
0
 /**
  * Remove the admin token
  *
  **/
 public function action_plugin_deactivation($file)
 {
     // delete default access token
     ACL::destroy_token('manage_categories');
 }
コード例 #17
0
ファイル: s3silo.plugin.php プロジェクト: ringmaster/s3silo
 /**
  *
  * @param string $file. The name of the plugin file
  *
  * Delete the special silo permissions if they're no longer
  * being used.
  */
 public function action_plugin_deactivation($file)
 {
     ACL::destroy_token('upload_s3_media');
     ACL::destroy_token('delete_s3_media');
 }
コード例 #18
0
ファイル: installhandler.php プロジェクト: habari/system
 private function upgrade_db_post_3158()
 {
     // delete own_post_typeX tokens rather than rebuild the whole default token set
     foreach (Post::list_active_post_types() as $name => $posttype) {
         ACL::destroy_token('own_post_' . Utils::slugify($name));
     }
     ACL::destroy_token('own_posts_any');
     ACL::create_token('own_posts', _t('Permissions on one\'s own posts'), 'Content', true);
 }
コード例 #19
0
 /**
  * Remove tokens from the tokens table.
  * @param integer $num number of tokens to remove, or configured value if null.
  */
 private function populate_tokens_remove($num = null)
 {
     // Get our own tokens.
     $tokens = $this->populate_tokens_get($num);
     // clean these tokens
     foreach ($tokens as $id => $token) {
         ACL::destroy_token($token->id);
     }
     return;
 }