staff can change trust levels

This commit is contained in:
Sam 2013-07-23 09:13:48 +10:00
parent ea7684fb32
commit 7b1f9928e4
2 changed files with 21 additions and 1 deletions

View File

@ -139,7 +139,7 @@ class Guardian
end end
def can_change_trust_level?(user) def can_change_trust_level?(user)
can_administer?(user) user && is_staff?
end end
def can_block_user?(user) def can_block_user?(user)

View File

@ -1041,5 +1041,25 @@ describe Guardian do
end end
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 end