diff options
author | travis%sedsystems.ca <> | 2005-03-16 07:10:13 +0100 |
---|---|---|
committer | travis%sedsystems.ca <> | 2005-03-16 07:10:13 +0100 |
commit | e490b45d57aee2aacd171a4a9b586111a8c88f53 (patch) | |
tree | b54185c9f669cd2b309f727ecb21e178968866ff /Bugzilla/User.pm | |
parent | 235eaf8436a7cb2f693c3fb8bc5d042c652c1c5f (diff) | |
download | bugzilla-e490b45d57aee2aacd171a4a9b586111a8c88f53.tar.gz bugzilla-e490b45d57aee2aacd171a4a9b586111a8c88f53.tar.xz |
Bug 283581 : Move UserInGroup out of globals.pl
Patch by Colin Ogilvie <colin.ogilvie@gmail.com> r=mkanat a=justdave
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r-- | Bugzilla/User.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 63b2f6848..fabffa621 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -45,6 +45,7 @@ use Bugzilla::Auth; use base qw(Exporter); @Bugzilla::User::EXPORT = qw(insert_new_user is_available_username login_to_id + UserInGroup ); ################################################################################ @@ -1058,6 +1059,10 @@ sub login_to_id ($) { } } +sub UserInGroup ($) { + return defined Bugzilla->user->groups->{$_[0]} ? 1 : 0; +} + 1; __END__ @@ -1335,8 +1340,6 @@ Params: $username (scalar, string) - The full login name of the username can change his username to $username. (That is, this function will return a boolean true value). -=back - =item C<login_to_id($login)> Takes a login name of a Bugzilla user and changes that into a numeric @@ -1351,6 +1354,12 @@ of a user, but you don't want the full weight of Bugzilla::User. However, consider using a Bugzilla::User object instead of this function if you need more information about the user than just their ID. +=item C<UserInGroup($groupname)> + +Takes a name of a group, and returns 1 if a user is in the group, 0 otherwise. + +=back + =head1 SEE ALSO L<Bugzilla|Bugzilla> |