From: <gem...@li...> - 2012-07-13 11:32:42
|
Revision: 843 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=843&view=rev Author: mennodekker Date: 2012-07-13 11:32:36 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Add some documentation about the way the userclass is selected and modified select to include the order by field Modified Paths: -------------- trunk/library/classes/Gems/User/UserLoader.php Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-07-13 10:27:56 UTC (rev 842) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-07-13 11:32:36 UTC (rev 843) @@ -556,12 +556,20 @@ { $select = $this->db->select(); + /** + * tolerance field: + * 1 - login and organization match + * 2 - login found in an organization with access to the requested organization + * 3 - login found in another organization without rights to the requested organiation + * (could be allowed due to privilege with rights to ALL organizations) + */ $select->from('gems__user_logins', array("gul_user_class", 'gul_id_organization', 'gul_login')) ->from('gems__organizations', array()) + ->columns(new Zend_Db_Expr("CASE WHEN gor_id_organization = gul_id_organization THEN 1 WHEN gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%') THEN 2 ELSE 3 END AS tolerance")) ->where('gor_active = 1') ->where('gul_can_login = 1') ->where('gor_id_organization = ?', $organization) - ->order("CASE WHEN gor_id_organization = gul_id_organization THEN 1 WHEN gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%') THEN 2 ELSE 3 END"); + ->order('tolerance'); $ids[] = 'gul_login'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |