diff options
author | http://jneen.net/ <jneen@jneen.net> | 2017-03-01 00:09:23 +0300 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2017-03-09 22:49:52 +0300 |
commit | d9cfed07cd1048328499ae06807368be29bdeb2c (patch) | |
tree | bca8d63e1c1c31fa5c6dca2878d789455a7f99f5 | |
parent | 846e581732e291f8927d04a5b1b40fe8f2688885 (diff) |
add User#internal? and some global permissions
-rw-r--r-- | app/models/user.rb | 5 | ||||
-rw-r--r-- | app/policies/global_policy.rb | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index db3837ecdf2..fa6f336f6b5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -350,12 +350,15 @@ class User < ActiveRecord::Base def ghost unique_internal(where(ghost: true), 'ghost', 'ghost%s@example.com') do |u| u.bio = 'This is a "Ghost User", created to hold all issues authored by users that have since been deleted. This user cannot be removed.' - u.state = :blocked u.name = 'Ghost User' end end end + def internal? + ghost? + end + # # Instance methods # diff --git a/app/policies/global_policy.rb b/app/policies/global_policy.rb index 3c2fbe6b56b..a1946584dd0 100644 --- a/app/policies/global_policy.rb +++ b/app/policies/global_policy.rb @@ -4,5 +4,11 @@ class GlobalPolicy < BasePolicy can! :create_group if @user.can_create_group can! :read_users_list + + unless @user.blocked? || @user.internal? + can! :log_in + can! :access_api + can! :access_git + end end end |