Restrict userselect.html.tmpl to Group editbugs?

Tosh, Michael J michael.j.tosh at lmco.com
Mon May 19 13:26:05 UTC 2008


I added the following sub to Bugzilla/Group.pm.  I will return a group
of user objects that are direct or inherited to a given group.  THIS
DOES NOT RESPECT STRICTISOLATION!!!  It is just a hack for myself.  If
you don't use strict isolation, you can use this sub to pass a hash of
user objects to the userselect.html.tmpl template.

sub members_inherited {
    my ($self) = @_;
    return $self->{members_inherited}
           if exists $self->{members_inherited};

    require Bugzilla::User;
    my $sql = 'SELECT DISTINCT user_id AS user_id FROM user_group_map
          WHERE isbless = 0 AND group_id IN(' .
 
join(',',@{Bugzilla::User->flatten_group_membership($self->id)}) .
          ')';
    my $in_member_ids = Bugzilla->dbh->selectcol_arrayref($sql,undef) ||
[];
    $self->{members_inherited} =
Bugzilla::User->new_from_list($in_member_ids);
    return $self->{members_inherited};
}

 

-----Original Message-----
From: dev-apps-bugzilla-bounces at lists.mozilla.org
[mailto:dev-apps-bugzilla-bounces at lists.mozilla.org] On Behalf Of
jimderrico at gmail.com
Sent: Friday, May 16, 2008 4:19 PM
To: dev-apps-bugzilla at lists.mozilla.org
Subject: Restrict userselect.html.tmpl to Group editbugs?

Hi,
Running 3.0 on Linux RH Enterprise 4
I am looking at global/userselect.html.tmpl and I would like to limit
the choices for assign_to (and maybe cc) to just users in the editbugs
Group. It currently lists all users for assign_to with:
[% FOREACH tmpuser = user.get_userlist %]

I could either use a way to generate a different list, something like
user.get_grouplist(editbugs)
or some way to filter the full user list further down with something
like [% IF tmpuser.in_group('editbugs') %]

I'm not sure what user.get_userlist returns (other than a hash) and/or
how to apply it to find out if the value in the FOREACH loop is in a
particular Group.

Any thoughts?
Thanks,
jim
_______________________________________________
dev-apps-bugzilla mailing list
dev-apps-bugzilla at lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-apps-bugzilla
_______________________________________________
dev-apps-bugzilla mailing list
dev-apps-bugzilla at lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-apps-bugzilla



More information about the developers mailing list