-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dany Marcoux
committed
Apr 26, 2021
1 parent
3f80986
commit 026b699
Showing
9 changed files
with
69 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,11 @@ | ||
class Token | ||
class RebuildPolicy < ApplicationPolicy | ||
|
||
# When are people allowed to rebuild? | ||
# - the token's user has access to the package | ||
|
||
def initialize(user, record, opts = {}) | ||
super(user, record) | ||
def initialize(_user, record) | ||
super(record.user, record) | ||
end | ||
|
||
def create? | ||
user.can_modify?(record) | ||
PackagePolicy.new(record.user, record.package_from_association_or_params).update? | ||
end | ||
end | ||
end | ||
|
||
# authorization needs to check: | ||
# use_source => ends up checking sourceaccess (package.check_source_access?) | ||
# follow_multibuild => already handled by backend (packages names with '*:' in the name) | ||
# follow_project_links => only rebuild can follow the links, the inherited packages can also be rebuilt | ||
|
||
# if not rebuilt then don't follow project links | ||
# opts = { use_source: false, | ||
# follow_project_links: true, | ||
# follow_multibuild: true } | ||
# Package.get_by_project_and_name(params[:project].to_s, params[:package].to_s, opts) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Token | ||
class ReleasePolicy < ApplicationPolicy | ||
def initialize(_user, record) | ||
super(record.user, record) | ||
end | ||
|
||
def create?; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Token | ||
class ServicePolicy < ApplicationPolicy | ||
def initialize(_user, record) | ||
super(record.user, record) | ||
end | ||
|
||
def create?; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters