Skip to content
Permalink
Browse files

EZP-23847: Add Role API parameter to get inherited RoleAssignments

To get direct UserRoleAssignments & inherited UserGroupRoleAssignments
  • Loading branch information...
andrerom committed Oct 29, 2014
1 parent 1eed4ef commit b4b02419847c991d24c5938962d83cda90aaca65
@@ -222,18 +222,23 @@ public function unassignRoleFromUser( Role $role, User $user );
public function getRoleAssignments( Role $role );
/**
* Returns the roles assigned to the given user
* Returns UserRoleAssignments assigned to the given User
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user
* If second parameter \$inherited is true then UserGroupRoleAssignment is also returned for UserGroups User is
* placed in as well as those inherited from parent UserGroups.
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the current user is not allowed to read a role
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException On invalid User object
*
* @param \eZ\Publish\API\Repository\Values\User\User $user
* @param boolean $inherited Also return all inherited Roles from UserGroups User belongs to, and it's parents.
*
* @return \eZ\Publish\API\Repository\Values\User\UserRoleAssignment[]
* @return \eZ\Publish\API\Repository\Values\User\UserRoleAssignment[]|\eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[]
*/
public function getRoleAssignmentsForUser( User $user );
public function getRoleAssignmentsForUser( User $user, $inherited = false );
/**
* Returns the roles assigned to the given user group
* Returns the UserGroupRoleAssignments assigned to the given UserGroup
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user group
*
@@ -604,15 +604,9 @@ public function getRoleAssignments( APIRole $role )
}
/**
* Returns the roles assigned to the given user
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user
*
* @param \eZ\Publish\API\Repository\Values\User\User $user
*
* @return \eZ\Publish\API\Repository\Values\User\UserRoleAssignment[]
* @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser()
*/
public function getRoleAssignmentsForUser( User $user )
public function getRoleAssignmentsForUser( User $user, $inherited = false )
{
$response = $this->client->request(
'GET',
@@ -802,15 +802,7 @@ public function getRoleAssignments( APIRole $role )
}
/**
* Returns the roles assigned to the given user
*
* @param \eZ\Publish\API\Repository\Values\User\User $user
* @param boolean $inherited
*
* @throws \eZ\Publish\Core\Base\Exceptions\UnauthorizedException If the current user is not allowed to read a role
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue On invalid User object
*
* @return \eZ\Publish\API\Repository\Values\User\UserRoleAssignment[]
* @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser()
*/
public function getRoleAssignmentsForUser( User $user, $inherited = false )
{
@@ -404,17 +404,11 @@ public function getRoleAssignments( Role $role )
}
/**
* Returns the roles assigned to the given user
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user
*
* @param \eZ\Publish\API\Repository\Values\User\User $user
*
* @return \eZ\Publish\API\Repository\Values\User\UserRoleAssignment[]
* @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser()
*/
public function getRoleAssignmentsForUser( User $user )
public function getRoleAssignmentsForUser( User $user, $inherited = false )
{
return $this->service->getRoleAssignmentsForUser( $user );
return $this->service->getRoleAssignmentsForUser( $user, $inherited );
}
/**
@@ -221,7 +221,7 @@ public function serviceProvider()
),
array(
'getRoleAssignmentsForUser',
array( $user ),
array( $user, true ),
array( $roleAssignement ),
0
),

0 comments on commit b4b0241

Please sign in to comment.
You can’t perform that action at this time.