Skip to content

Commit 479f9ec

Browse files
Add some methods in ProjectService for managing project roles (#504)
* Update ProjectService.php to add some methods for projectRoles * Update ProjectService.php
1 parent 4708c25 commit 479f9ec

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/Project/ProjectService.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,4 +394,49 @@ public function archiveProject(int|string $projectIdOrKey): string
394394

395395
return $ret;
396396
}
397+
398+
/**
399+
* Get all the Roles of a Jira Project.
400+
*
401+
* @param int|string $projectIdOrKey
402+
*
403+
* @throws JiraException
404+
*
405+
* @return string
406+
*/
407+
public function getRolesOfProject(int|string $projectIdOrKey): string
408+
{
409+
return $this->exec($this->uri.'/'.$projectIdOrKey.'/role', null, 'PUT');
410+
}
411+
412+
/**
413+
* Assign a Role to a Project.
414+
*
415+
* @param int|string $projectIdOrKey
416+
* @param int $roleId
417+
*
418+
* @throws JiraException
419+
*
420+
* @return string
421+
*/
422+
public function assignRoleToProject(int|string $projectIdOrKey, int $roleId): string
423+
{
424+
return $this->exec($this->uri.'/'.$projectIdOrKey.'/role/'.$roleId, null, 'PUT');
425+
}
426+
427+
/**
428+
* Add Role Actor to a Project Role.
429+
*
430+
* @param int|string $projectIdOrKey
431+
* @param int $roleId
432+
* @param string $actor
433+
*
434+
* @throws JiraException
435+
*
436+
* @return string
437+
*/
438+
public function addProjectRoleActors(int|string $projectIdOrKey, int $roleId, string $actor): string
439+
{
440+
return $this->exec($this->uri.'/'.$projectIdOrKey.'/role/'.$roleId, $actor, 'POST');
441+
}
397442
}

0 commit comments

Comments
 (0)