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


PHP UserGroup::get_by_name方法代碼示例

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


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

示例1: install

 /**
  * Set up needed stuff for the plugin
  **/
 public function install()
 {
     Post::add_new_type('project');
     // Give anonymous users access
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_project', 'read');
 }
開發者ID:habari-extras,項目名稱:mpango,代碼行數:10,代碼來源:mpango.plugin.php

示例2: action_plugin_activation

 public function action_plugin_activation($file)
 {
     DB::register_table('abbrev');
     /*
      * Create the database table, or upgrade it
      */
     $dbms = DB::get_driver_name();
     $sql = 'CREATE TABLE ' . DB::table('abbrev') . ' ' . '(';
     if ($dbms == 'sqlite') {
         $sql .= 'xid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,';
     } else {
         if ($dbms == 'mysql') {
             $sql .= 'xid INT(9) NOT NULL AUTO_INCREMENT,' . 'UNIQUE KEY xid (xid),';
         } else {
             $sql .= 'xid INT(9) NOT NULL AUTO_INCREMENT,' . 'UNIQUE KEY xid (xid),';
         }
     }
     $sql .= 'abbrev VARCHAR(255),' . 'caseful INTEGER DEFAULT 0,' . "prefix VARCHAR(16) DEFAULT '\\b'," . "postfix VARCHAR(16) DEFAULT '\\b'," . 'priority INTEGER DEFAULT 100,' . 'definition VARCHAR(255)' . ')';
     if (!DB::dbdelta($sql)) {
         Utils::debug(DB::get_errors());
     }
     if ($file == str_replace('\\', '/', $this->get_file())) {
         ACL::create_token(self::PLUGIN_TOKEN, _t('Allow use of Abbrev plugin'), 'Category', false);
         $group = UserGroup::get_by_name('admin');
         $group->grant(self::PLUGIN_TOKEN);
     }
 }
開發者ID:habari-extras,項目名稱:abbrev,代碼行數:27,代碼來源:abbrev.plugin.php

示例3: action_plugin_activation

 /**
  * Register content type
  **/
 public function action_plugin_activation($plugin_file)
 {
     // add the content type.
     Post::add_new_type('event');
     // Give anonymous users access
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_event', 'read');
 }
開發者ID:habari-extras,項目名稱:eventscontent,代碼行數:11,代碼來源:eventscontent.plugin.php

示例4: install

 /**
  * install:
  * - post type
  * - permissions
  */
 public static function install()
 {
     Post::add_new_type('event');
     Post::activate_post_type('event');
     // Give anonymous users access
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_event', 'read');
 }
開發者ID:habari-extras,項目名稱:partytime,代碼行數:13,代碼來源:partytime.plugin.php

示例5: action_plugin_activation

 public function action_plugin_activation($file)
 {
     if ($file == str_replace('\\', '/', $this->get_file())) {
         ACL::create_token(self::PLUGIN_TOKEN, _t('Allow use of AtomIcon plugin'), 'Category', false);
         $group = UserGroup::get_by_name('admin');
         $group->grant(self::PLUGIN_TOKEN);
     }
 }
開發者ID:habari-extras,項目名稱:atomicon,代碼行數:8,代碼來源:atomicon.plugin.php

示例6: action_plugin_activation

 /**
  * Add the category vocabulary and create the admin token
  *
  **/
 public function action_plugin_activation($file)
 {
     $params = array('name' => self::$vocabulary, 'description' => 'A vocabulary for describing Categories', 'features' => array('multiple', 'hierarchical'));
     Vocabulary::create($params);
     // create default access token
     ACL::create_token('manage_categories', _t('Manage categories'), 'Administration', false);
     $group = UserGroup::get_by_name('admin');
     $group->grant('manage_categories');
 }
開發者ID:habari-extras,項目名稱:simplecategories,代碼行數:13,代碼來源:simplecategories.plugin.php

示例7: install

 /**
  * install various stuff we need
  */
 public static function install()
 {
     /**
      * Register content type
      **/
     Post::add_new_type('report');
     // Give anonymous users access
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_report', 'read');
 }
開發者ID:habari-extras,項目名稱:reportr,代碼行數:13,代碼來源:reportr.plugin.php

示例8: action_plugin_activation

 /**
  * Create an admin token for editing menus
  **/
 public function action_plugin_activation($file)
 {
     // create default access token
     ACL::create_token('manage_menus', _t('Manage menus', 'termmenus'), 'Administration', false);
     $group = UserGroup::get_by_name('admin');
     $group->grant('manage_menus');
     // register menu types
     Vocabulary::add_object_type('menu_link');
     Vocabulary::add_object_type('menu_spacer');
 }
開發者ID:habari-extras,項目名稱:termmenus,代碼行數:13,代碼來源:termmenus.plugin.php

示例9: install

 /**
  * install various stuff we need
  */
 public static function install()
 {
     Post::add_new_type('link');
     // Give anonymous users access
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_link', 'read');
     // Set default settings
     Options::set('linkblog__original', '<p><a href="{permalink}">Permalink</a></p>');
     Options::set('linkblog__atom_permalink', false);
     self::database();
 }
開發者ID:habari-extras,項目名稱:linkblog,代碼行數:14,代碼來源:linkblog.plugin.php

示例10: action_plugin_activation

 /**
  * Add the shelf vocabulary and create the admin token
  *
  **/
 public function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         $params = array('name' => self::$vocabulary, 'description' => 'A vocabulary for describing Shelves', 'features' => array('hierarchical'));
         Vocabulary::create($params);
         // create default access token
         ACL::create_token('manage_shelves', _t('Manage ') . Options::get('shelves__plural', _t('shelves', 'shelves')), 'Administration', false);
         $group = UserGroup::get_by_name('admin');
         $group->grant('manage_shelves');
     }
 }
開發者ID:habari-extras,項目名稱:shelves,代碼行數:15,代碼來源:shelves.plugin.php

示例11: test_admin_access

 /**
  * function test_admin_access
  *
  **/
 public function test_admin_access()
 {
     // Add acl-alice to the admin group
     //(which has been granted admin priviliges in installhandler).
     $this->acl_user_alice->add_to_group('admin');
     $admin_group = UserGroup::get_by_name('admin');
     if ($admin_group instanceof UserGroup) {
         $admin_group->update();
     }
     $this->assert_true($this->acl_user_alice->can('admin'), 'Admin user does not have admin permission.');
     $this->assert_false($this->acl_user_bob->can('admin'), 'Unpriviliged user has admin permission.');
 }
開發者ID:habari,項目名稱:tests,代碼行數:16,代碼來源:test_acl.php

示例12: create

 /**
  * Create a new UserGroup object and save it to the database
  * @param array $paramarray An associative array of UserGroup fields
  * @return UserGroup the UserGroup that was created
  * @todo Make this function accept only a name, since you can't set an id into an autoincrement field, and we don't try.
  */
 public static function create($paramarray)
 {
     $usergroup = new UserGroup($paramarray);
     if ($usergroup->insert()) {
         return $usergroup;
     } else {
         // Does the group already exist?
         if (isset($paramarray['name'])) {
             $exists = DB::get_value('SELECT count(1) FROM {groups} WHERE name = ?', array($paramarray['name']));
             if ($exists) {
                 return UserGroup::get_by_name($paramarray['name']);
             }
         }
         return false;
     }
 }
開發者ID:anupom,項目名稱:my-blog,代碼行數:22,代碼來源:usergroup.php

示例13: action_plugin_activation

 /**
  * Hook on activation of this plugin
  */
 public function action_plugin_activation()
 {
     // add the new content types
     Post::add_new_type('addon');
     // allow reading the new content types
     UserGroup::get_by_name('anonymous')->grant('post_addon', 'read');
     // create a permissions token
     ACL::create_token('manage_versions', _t('Manage Addon Versions', 'addon_catalog'), 'Addon Catalog', false);
     // create the addon vocabulary (type)
     Vocabulary::add_object_type('addon');
     // create the addon vocabulary
     $params = array('name' => self::CATALOG_VOCABULARY, 'description' => _t('A vocabulary for addon versions in the addons catalog', 'addon_catalog'));
     $vocabulary = Vocabulary::create($params);
     // @TODO: notification/log of some sort?
     // create the default content
     include 'create_core_addons.php';
 }
開發者ID:habari-extras,項目名稱:addon_catalog,代碼行數:20,代碼來源:addon_catalog.plugin.php

示例14: action_plugin_activation

 /**
  * Run activation routines, and setup default options.
  */
 public function action_plugin_activation()
 {
     if (!CronTab::get_cronjob('blogroll:update')) {
         CronTab::add_hourly_cron('blogroll:update', 'blogroll_update_cron', 'Updates the blog updated timestamp from weblogs.com');
     }
     Options::set('blogroll__api_version', self::API_VERSION);
     Options::set('blogroll__use_updated', true);
     Options::set('blogroll__max_links', '10');
     Options::set('blogroll__sort_by', 'id');
     Options::set('blogroll__direction', 'ASC');
     Options::set('blogroll__list_title', 'Blogroll');
     Post::add_new_type(self::CONTENT_TYPE);
     // Give anonymous users access, if the group exists
     $group = UserGroup::get_by_name('anonymous');
     if ($group) {
         $group->grant(self::CONTENT_TYPE, 'read');
     }
 }
開發者ID:habari-extras,項目名稱:blogroll,代碼行數:21,代碼來源:blogroll.plugin.php

示例15: action_plugin_activation

 public function action_plugin_activation($plugin_file)
 {
     Post::add_new_type('urlbounce');
     $group = UserGroup::get_by_name('anonymous');
     $group->grant('post_urlbounce', 'read');
 }
開發者ID:habari-extras,項目名稱:urlbounce,代碼行數:6,代碼來源:urlbounce.plugin.php


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