Skip to content

Commit

Permalink
Merge pull request #8838 from vpereira/move_errors_from_bs_request_pe…
Browse files Browse the repository at this point in the history
…rmission_check

Move errors from BsRequestPermissionCheck to BsRequest::Errors
  • Loading branch information
vpereira committed Dec 4, 2019
2 parents df8918c + dceb551 commit 701e7f0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
37 changes: 37 additions & 0 deletions src/api/app/models/bs_request/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,41 @@ class UnderEmbargo < APIError
class SaveError < APIError
setup 'request_save_error'
end
class AddReviewNotPermitted < APIError
setup 403
end

class NotExistingTarget < APIError
setup 404
end

class SourceChanged < APIError
end

class ReleaseTargetNoPermission < APIError
setup 403
end

class ProjectLocked < APIError
setup 403, 'The target project is locked'
end

class TargetNotMaintenance < APIError
setup 404
end

class SourceMissing < APIError
setup 'unknown_package', 404
end

class SetPriorityNoPermission < APIError
setup 403
end

class ReviewChangeStateNoPermission < APIError
setup 403
end

class ReviewNotSpecified < APIError
end
end
38 changes: 1 addition & 37 deletions src/api/app/models/bs_request_permission_check.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
class BsRequestPermissionCheck
class AddReviewNotPermitted < APIError
setup 403
end

class NotExistingTarget < APIError
setup 404
end

class SourceChanged < APIError
end

class ReleaseTargetNoPermission < APIError
setup 403
end

class ProjectLocked < APIError
setup 403, 'The target project is locked'
end

class TargetNotMaintenance < APIError
setup 404
end

class SourceMissing < APIError
setup 'unknown_package', 404
end

class SetPriorityNoPermission < APIError
setup 403
end

class ReviewChangeStateNoPermission < APIError
setup 403
end

class ReviewNotSpecified < APIError
end
include BsRequest::Errors

def cmd_addreview_permissions(permissions_granted)
unless req.state.in?([:review, :new])
Expand Down

0 comments on commit 701e7f0

Please sign in to comment.