This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes the previous commit so only the proper circles are shown to the current user. Signed-off-by: Miquel Sabaté Solà <[email protected]>
- Loading branch information
Showing
5 changed files
with
145 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
module NamespacesHelper | ||
def can_manage_namespace?(namespace) | ||
current_user.admin? || namespace.team.owners.exists?(current_user.id) | ||
current_user.admin? || owner?(namespace) | ||
end | ||
|
||
def owner?(namespace) | ||
namespace.team.owners.exists?(current_user.id) | ||
end | ||
|
||
def contributor?(namespace) | ||
namespace.team.contributors.exists?(current_user.id) | ||
end | ||
|
||
def viewer?(namespace) | ||
namespace.team.viewers.exists?(current_user.id) | ||
end | ||
|
||
def can_pull?(namespace) | ||
NamespacePolicy.new(current_user, namespace).pull? | ||
end | ||
|
||
def can_push?(namespace) | ||
NamespacePolicy.new(current_user, namespace).push? | ||
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
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