public function publishRoleDraft($roleDraftId)
    {
        $roleDraft = $this->loadRole($roleDraftId, Role::STATUS_DRAFT);

        try {
            $originalRoleId = $roleDraft->originalId;
            $role = $this->loadRole($originalRoleId);
            $roleAssignments = $this->loadRoleAssignmentsByRoleId($role->id);
            $this->deleteRole($role->id);

            foreach ($roleAssignments as $roleAssignment) {
                if (empty($roleAssignment->limitationIdentifier)) {
                    $this->assignRole($roleAssignment->contentId, $originalRoleId);
                } else {
                    $this->assignRole(
                        $roleAssignment->contentId,
                        $originalRoleId,
                        [$roleAssignment->limitationIdentifier => $roleAssignment->values]
                    );
                }
            }
            $this->roleGateway->publishRoleDraft($roleDraft->id, $role->id);
        } catch (NotFound $e) {
            // If no published role is found, only publishing is needed, without specifying original role ID as there is none.
            $this->roleGateway->publishRoleDraft($roleDraft->id);
        }
    }
public function publishRoleDraft($roleDraftId)
    {
        $roleDraft = $this->loadRole($roleDraftId, Role::STATUS_DRAFT);

        try {
            $originalRoleId = $roleDraft->originalId;
            $role = $this->loadRole($originalRoleId);
            $roleAssignments = $this->loadRoleAssignmentsByRoleId($role->id);
            $this->deleteRole($role->id);

            foreach ($roleAssignments as $roleAssignment) {
                if (empty($roleAssignment->limitationIdentifier)) {
                    $this->assignRole($roleAssignment->contentId, $originalRoleId);
                } else {
                    $this->assignRole(
                        $roleAssignment->contentId,
                        $originalRoleId,
                        [$roleAssignment->limitationIdentifier => $roleAssignment->values]
                    );
                }
            }
            $this->roleGateway->publishRoleDraft($roleDraft->id, $role->id);
        } catch (NotFound $e) {
            // If no published role is found, only publishing is needed, without specifying original role ID as there is none.
            $this->roleGateway->publishRoleDraft($roleDraft->id);
        }
    }
public function publishRoleDraft ( $ roleDraftId ) { $ roleDraft = $ this -> loadRole ( $ roleDraftId , Role :: STATUS_DRAFT ) ; try { $ originalRoleId = $ roleDraft -> originalId ; $ role = $ this -> loadRole ( $ originalRoleId ) ; $ roleAssignments = $ this -> loadRoleAssignmentsByRoleId ( $ role -> id ) ; $ this -> deleteRole ( $ role -> id ) ; foreach ( $ roleAssignments as $ roleAssignment ) { if ( empty ( $ roleAssignment -> limitationIdentifier ) ) { $ this -> assignRole ( $ roleAssignment -> contentId , $ originalRoleId ) ; } else { $ this -> assignRole ( $ roleAssignment -> contentId , $ originalRoleId , [ $ roleAssignment -> limitationIdentifier => $ roleAssignment -> values ] ) ; } } $ this -> roleGateway -> publishRoleDraft ( $ roleDraft -> id , $ role -> id ) ; } catch ( NotFound $ e ) { // If no published role is found, only publishing is needed, without specifying original role ID as there is none. $ this -> roleGateway -> publishRoleDraft ( $ roleDraft -> id ) ; } }
Publish the specified role draft.

@param mixed $roleDraftId
Publish the specified role draft .