staff can change trust levels
This commit is contained in:
parent
ea7684fb32
commit
7b1f9928e4
|
@ -139,7 +139,7 @@ class Guardian
|
|||
end
|
||||
|
||||
def can_change_trust_level?(user)
|
||||
can_administer?(user)
|
||||
user && is_staff?
|
||||
end
|
||||
|
||||
def can_block_user?(user)
|
||||
|
|
|
@ -1041,5 +1041,25 @@ describe Guardian do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'can_change_trust_level?' do
|
||||
|
||||
it 'is false without a logged in user' do
|
||||
Guardian.new(nil).can_change_trust_level?(user).should be_false
|
||||
end
|
||||
|
||||
it 'is false for regular users' do
|
||||
Guardian.new(user).can_change_trust_level?(user).should be_false
|
||||
end
|
||||
|
||||
it 'is true for moderators' do
|
||||
Guardian.new(moderator).can_change_trust_level?(user).should be_true
|
||||
end
|
||||
|
||||
it 'is true for admins' do
|
||||
Guardian.new(admin).can_change_trust_level?(user).should be_true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue