5.7.133. Bugzilla::Extension::AgileTools::Util

5.7.133.1. NAME

Bugzilla::Extension::AgileTools::Util - AgileTools utility functions

5.7.133.2. SYNOPSIS

use Bugzilla::Extension::AgileTools::Util;

my $user = get_user(1);
my $user = get_user('john.doe@example.com');

my $team = get_team($team_id);

my $role = get_role($role_id);
my $role = get_role("Scrum Master");

5.7.133.3. DESCRIPTION

AgileTools extension utility functions

5.7.133.4. FUNCTIONS

get_user($user)

Description: Gets user object or throws error if user is not found. Without
             parameters returns the logged in user
Params:      $user -> User ID or login name
Returns:     L<Bugzilla::User> object

get_team($team_id, $edit)

Description: Gets team object or throws error if team is not found
Params:      $team_id -> Team ID
             $edit - If true, checks that user is allowed to edit the team
Returns:     L<Bugzilla::Extension::AgileTools::Team> object

get_role($role)

Description: Gets role object or throws error if role is not found
Params:      $role -> Role ID or name
Returns:     L<Bugzilla::Extension::AgileTools::Role> object

user_can_change_estimated_time($bug, $user)

Description: Check if user is allowed to change the estimated time of a bug
Params:      $bug - Bug object to check against
             $user - (optional) User object, login name or ID
Returns:     1 if user can do the change

user_can_manage_teams($user)

Description: Check if user is allowed to create/remove teams
Params:      $user - (optional) User object, login name or ID
Returns:     1 if user can manage teams, 0 otherwise

Note: Currently just checks if user is in group admin, but we might provide additional groups to identify user allowed to create and remove teams in the future.

user_in_agiletools_group($user, $throwerror)

Description: Check if user is in AgileTools user group
Params:      $throwerror - (Optional) If true, throw access denied erro if
             there is no logged in user or the user is not in the group.

Returns:     true if user in AgileTools user group or if the group is not
             defined

This documentation undoubtedly has bugs; if you find some, please file them here.