mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 11:54:41 +08:00
work in progress, add fidelity to category group permissions (full, create posts, readonly)
This commit is contained in:
@ -41,8 +41,7 @@ describe CategoryList do
|
||||
|
||||
cat = Fabricate(:category)
|
||||
topic = Fabricate(:topic, category: cat)
|
||||
cat.deny(:all)
|
||||
cat.allow(Group[:admins])
|
||||
cat.set_permissions(:admins => :full)
|
||||
cat.save
|
||||
|
||||
CategoryList.new(Guardian.new admin).categories.count.should == 1
|
||||
|
@ -215,8 +215,9 @@ describe Guardian do
|
||||
|
||||
it 'correctly handles groups' do
|
||||
group = Fabricate(:group)
|
||||
category = Fabricate(:category, secure: true)
|
||||
category.allow(group)
|
||||
category = Fabricate(:category, read_restricted: true)
|
||||
category.set_permissions(group => :full)
|
||||
category.save
|
||||
|
||||
topic = Fabricate(:topic, category: category)
|
||||
|
||||
|
@ -62,8 +62,7 @@ describe PostCreator do
|
||||
admin = Fabricate(:admin)
|
||||
|
||||
cat = Fabricate(:category)
|
||||
cat.deny(:all)
|
||||
cat.allow(Group[:admins])
|
||||
cat.set_permissions(:admins => :full)
|
||||
cat.save
|
||||
|
||||
created_post = nil
|
||||
|
@ -171,8 +171,7 @@ describe Search do
|
||||
topic.category_id = category.id
|
||||
topic.save
|
||||
|
||||
category.deny(:all)
|
||||
category.allow(Group[:staff])
|
||||
category.set_permissions(:staff => :full)
|
||||
category.save
|
||||
|
||||
result(nil).should_not be_present
|
||||
@ -211,7 +210,7 @@ describe Search do
|
||||
r[:title].should == category.name
|
||||
r[:url].should == "/category/#{category.slug}"
|
||||
|
||||
category.deny(:all)
|
||||
category.set_permissions({})
|
||||
category.save
|
||||
|
||||
result.should_not be_present
|
||||
|
@ -14,9 +14,8 @@ describe TopicQuery do
|
||||
context 'secure category' do
|
||||
it "filters categories out correctly" do
|
||||
category = Fabricate(:category)
|
||||
category.deny(:all)
|
||||
group = Fabricate(:group)
|
||||
category.allow(group)
|
||||
category.set_permissions(group => :full)
|
||||
category.save
|
||||
|
||||
topic = Fabricate(:topic, category: category)
|
||||
|
Reference in New Issue
Block a user