diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-16 07:41:33 -0700 | 
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-16 08:55:26 -0700 | 
| commit | bc241e44c2e4d10ac19ccc32a40c90426672d963 (patch) | |
| tree | aade0e13346a059c061e2f2f4a767e25a45fe17b /modules/gallery/libraries | |
| parent | 00eacd659f27df9c13246c510057c4f42c8866a2 (diff) | |
Cleanup merge of user/group helpers into Identity interface.  Reduce redundant code in the user module and remove references to the Identity helper from the user module as the user module should be able to access things directly. Simplify the get_user_list api method to just accept an array of ids to return user objects for.
Diffstat (limited to 'modules/gallery/libraries')
| -rw-r--r-- | modules/gallery/libraries/Identity.php | 18 | ||||
| -rw-r--r-- | modules/gallery/libraries/drivers/Identity.php | 41 | 
2 files changed, 7 insertions, 52 deletions
| diff --git a/modules/gallery/libraries/Identity.php b/modules/gallery/libraries/Identity.php index 229d0da9..fb553de6 100644 --- a/modules/gallery/libraries/Identity.php +++ b/modules/gallery/libraries/Identity.php @@ -191,22 +191,8 @@ class Identity_Core {    /**     * @see Identity_Driver::get_user_list.     */ -  static function get_user_list($filter=array()) { -    return self::instance()->driver->get_user_list($filter); -  } - -  /** -   * @see Identity_Driver::get_group_list. -   */ -  static function get_group_list($filter=array()) { -    return self::instance()->driver->get_group_list($filter); -  } - -  /** -   * @see Identity_Driver::get_edit_rules. -   */ -  static function get_edit_rules($object_type) { -    return self::instance()->driver->get_edit_rules($object_type); +  static function get_user_list($ids) { +    return self::instance()->driver->get_user_list($ids);    }    static function get_login_form($url) { diff --git a/modules/gallery/libraries/drivers/Identity.php b/modules/gallery/libraries/drivers/Identity.php index 0b789908..a9e1a75b 100644 --- a/modules/gallery/libraries/drivers/Identity.php +++ b/modules/gallery/libraries/drivers/Identity.php @@ -83,37 +83,11 @@ interface Identity_Driver {    /**     * List the users -   * @param mixed      options to apply to the selection of the user -   *                   currently supported: -   *                     "orderby" => array(<field name>, "ASC|DESC") -   *                     "in" => array(<field name>, array(values, ...)) -   *                     "where" => array(<field name>, value) -   *                        <field name> follows Kohana syntax where it could contain the first -   *                                     half of a logical expression (i.e. "field IS NOT") -   * @return array     the group list. +   * @param array      array of ids to return the user objects for +   * @return array     the user list.     */ -  public function get_user_list($filter=array()); +  public function get_user_list($ids); -  /** -   * List the groups -   * @param mixed      options to apply to the selection of the group -   *                   currently supported: -   *                     "orderby" => array(<field name>, "ASC|DESC") -   *                     "in" => array(<field name>, array(values, ...)) -   *                     "where" => array(<field name>, value) -   *                        <field name> follows Kohana syntax where it could contain the first -   *                                     half of a logical expression (i.e. "field IS NOT") -   * @return array     the group list. -   */ -  public function get_group_list($filter=array()); - -  /** -   * Return the edit rules associated with an group. -   * -   * @param  string   $object_type to return rules for ("user"|"group") -   * @return stdClass containing the rules -   */ -  public function get_edit_rules($object_type);  } // End Identity Driver Definition  /** @@ -205,19 +179,14 @@ abstract class User_Definition {     * @param integer $size the target size of the image (default 80px)     * @return string a url     */ -  public function avatar_url($size=80, $default=null) { -    return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg%s", -                   md5($this->user->email), $size, $default ? "&d=" . urlencode($default) : ""); -  } +  abstract public function avatar_url($size=80, $default=null);    /**     * Return the best version of the user's name.  Either their specified full name, or fall back     * to the user name.     * @return string     */ -  public function display_name() { -    return empty($this->user->full_name) ? $this->user->name : $this->user->full_name; -  } +  abstract public function display_name();    /**     * Return the internal user object without the wrapper. | 
