Skip to content

Commit 1b0e49f

Browse files
author
root
committed
Move allowed_to_commit method
1 parent 545af1f commit 1b0e49f

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/models/concerns/gitolitable_permissions.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ def deletable?
8282
end
8383

8484

85-
def allowed_to_commit?
86-
User.current.allowed_to?(:commit_access, project) ? 'true' : 'false'
87-
end
88-
89-
9085
def allowed_to_ssh?
9186
!User.current.anonymous? && User.current.allowed_to?(:create_gitolite_ssh_key, nil, global: true)
9287
end

app/models/concerns/gitolitable_urls.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def go_url
6565

6666

6767
def ssh_access
68-
{ url: ssh_url, committer: allowed_to_commit? }
68+
{ url: ssh_url, committer: User.current.allowed_to_commit?(project).to_s }
6969
end
7070

7171

@@ -76,7 +76,7 @@ def http_access
7676

7777

7878
def https_access
79-
{ url: https_url, committer: allowed_to_commit? }
79+
{ url: https_url, committer: User.current.allowed_to_commit?(project).to_s }
8080
end
8181

8282

@@ -86,7 +86,7 @@ def git_access
8686

8787

8888
def git_annex_access
89-
{ url: git_annex_url, committer: allowed_to_commit? }
89+
{ url: git_annex_url, committer: User.current.allowed_to_commit?(project).to_s }
9090
end
9191

9292

lib/redmine_git_hosting/patches/user_patch.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def status_has_changed?
4242
end
4343

4444

45+
def allowed_to_commit?(project)
46+
allowed_to?(:commit_access, project)
47+
end
48+
49+
4550
private
4651

4752

0 commit comments

Comments
 (0)