I'm working on the backend side of a web application, with the
sfDoctrineGuardPlugin. 
In sfGuardUser/config/generator.yml, I add the line : 
      list:
        table_method: retrieveAdminsList
 
and in the model : 
class sfGuardUserTable extends PluginsfGuardUserTable {
    public function retrieveAdminsList(Doctrine_Query $q) {
       $rootAlias = $q->getRootAlias();
       $q->leftJoin($rootAlias.'.groups g');
       return $q;
    }
}
 
The generated SQL is : 
SELECT s.id AS s__id, s.username AS s__username, s.algorithm AS
s__algorithm, s.salt AS s__salt, s.password AS s__password, s.is_active
AS s__is_active, s.is_super_admin AS s__is_super_admin, s.last_login AS
s__last_login, s.created_at AS s__created_at, s.updated_at AS
s__updated_at, s2.id AS s2__id, s2.name AS s2__name, s2.description AS
s2__description, s2.created_at AS s2__created_at, s2.updated_at AS
s2__updated_at FROM sf_guard_user s LEFT JOIN sf_guard_user_group s3 ON
(s.id = s3.user_id) LEFT JOIN sf_guard_group s2 ON s2.id = s3.group_id
WHERE s.id IN ('16', '1', '3')
 
I don't understand why this 
WHERE s.id IN ('16', '1', '3')
is appended to the request. 
 
NB : 1, 3, 16 are the 3 ids registered in the sf_guard_user table. 
 
Moreover, this behaviour leads to an incorrect  request if I want to
display only administrators : 

class sfGuardUserTable extends PluginsfGuardUserTable {
    public function retrieveAdminsList(Doctrine_Query $q) {
       $rootAlias = $q->getRootAlias();
       $q->leftJoin($rootAlias.'.groups g')
           ->andWhere('g.id = ?', sfGuardUserGroup::ADMIN);
       return $q;
    }
}
 
Generated SQL : 
SELECT s.id AS s__id, s.username AS s__username, s.algorithm AS
s__algorithm, s.salt AS s__salt, s.password AS s__password, s.is_active
AS s__is_active, s.is_super_admin AS s__is_super_admin, s.last_login AS
s__last_login, s.created_at AS s__created_at, s.updated_at AS
s__updated_at, s2.id AS s2__id, s2.name AS s2__name, s2.description AS
s2__description, s2.created_at AS s2__created_at, s2.updated_at AS
s2__updated_at FROM sf_guard_user s LEFT JOIN sf_guard_user_group s3 ON
(s.id = s3.user_id) LEFT JOIN sf_guard_group s2 ON s2.id = s3.group_id
WHERE s.id IN ('1') AND (s2.id = 1)
!! 
 
s2.id = 1 is OK, this is my filter.
But s.id IN ('1') is wrong. 
 
What did I miss here ? How can I configure the module to display only
one specific group of users ? 

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to