can not make a wiki not public

Support Ticket

+status
+tags
 

I use wagn 1.7.0 from gitgub.

 

I want to have a closed wiki. Only signed in users should be alle to read any cards. I tried to edit *all*read, but:

 

  1. Changing the value fom Anyone to Anyone Signed In does not work. After saving the content is still Anyone
  2. deleting an adding *all*read again results in an error:
    Oops!
    error saving *all+*read: undefined method `raw_content' for nil:NilClass, /data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:110:in `rule_card'/data/var/local/www/wiki/wagn/app/models/user.rb:59:in `as'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:109:in `rule_card'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:112:in `rule_card'/data/var/local/www/wiki/wagn/app/models/user.rb:59:in `as'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:109:in `rule_card'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:195:in `set_read_rule'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:271:in `included'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:93:in `call'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:93:in `run'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:92:in `each'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:92:in `send'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:92:in `run'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:276:in `run_callbacks'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/callbacks.rb:344:in `callback'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/callbacks.rb:249:in `create_or_update'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:2577:in `save_without_validation'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/validations.rb:1090:in `save_without_dirty'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/dirty.rb:79:in `save_without_transactions'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:229:in `send'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:182:in `transaction'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:196:in `save_without_trash'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:196:in `save_without_trash'/data/var/local/www/wiki/wagn/app/models/card.rb:111:in `save_without_permissions'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:53:in `send'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:53:in `run_checked_save'/data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:42:in `save'/data/var/local/www/wiki/wagn/app/controllers/card_controller.rb:114:in `create'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `send'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `perform_action_without_filters'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:617:in `call_filters'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in `perform_action'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `send'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `process_without_filters'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:in `process'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:391:in `process'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:386:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/routing/route_set.rb:438:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:87:in `dispatch'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:121:in `_call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:in `cache'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:28:in `call'/var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/string_coercion.rb:25:in `call'/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/head.rb:9:in `call'/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/params_parser.rb:15:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/session/cookie_store.rb:99:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:in `call'/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `synchronize'/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'/var/lib/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:106:in `call'/var/lib/gems/1.8/gems/thin-1.2.11/lib/rack/adapter/rails.rb:69:in `call'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:84:in `pre_process'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'/var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'/var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in `start'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'/var/lib/gems/1.8/gems/thin-1.2.11/bin/thin:6/usr/bin/thin:19:in `load'/usr/bin/thin:19
    

How could I setup a wagn wiki which only signed in user could read an edit?

 

#1 is the right approache.  #2 is clearly an ugly message, but I'm not surprised that there would be some kind of error if you try to delete any given *all permission card (+*create,+*read, +*update, or +*delete), and especially the *all+*read card.  There does need to be some sort of default permission setting, especially for *read.

 

But I'm not sure why #1 wouldn't work.  My guess is that it would be quite slow (only for *read, not for the other permissions), but that it should work.  Are you seeing errors in the log?

 

I would recommend that you try changing to "Anyone Signed In" again and watch the log.  It may take a long time -- even as much as a minute or two.  If the save is successful and it still says "Anyone", try clearing the cache by going to /admin/clear_cache in the browser.

 

If that doesn't work and you don't see anything in the log, try doing the same thing in development mode and see if that gives you any more information.


#1 works now. I have changed from "Anyone" to "Anyone Signed In" and cleared the cache. Then *read had "Anyone" as value. Then I changed again to "Anyone Signed In" and cleared the cache. Now *read had the value "Anyone Signed In".

Opening the first page works, but no styles will be applied. *css seems to be also protected.

  --dermicha.....Fri Aug 05 13:58:38 -0700 2011


setting *css+*self+ *read to "Anyone" does not solve the problem with the missing layout of the first page.

  --dermicha.....Fri Aug 05 14:07:56 -0700 2011


Ah, yes, there are several other cards that need to be opened up (with +*self+*read settings) for the home page to look right:

 

1. *head (this is the card for the tag. it should fix the styling issue)

2. *account links (sign-in, sign-up)

3. *version (the wagn version)

 

Depending on your setup, you may also want to open up *sidebar, *logo, *navbar, etc.

 

This is admittedly a little clunky. We'll need to find a cleaner solution for this, but compared to the challenge of building the new permissions system, this is a pretty small hurdle!

  --Ethan McCutchen.....Fri Aug 05 14:20:05 -0700 2011


might it possible to do that changes using the REST API? It would be great for me to learn how that API exacttly works.

  --dermicha.....Fri Aug 05 15:02:42 -0700 2011


sign in an sign out works. After sign in everthing looks as expacted.

 

after changing *read of *head, *account, * version and *logo my start page looks nice. Thanks.

  --dermicha.....Fri Aug 05 15:15:04 -0700 2011


the true RESTful Web API is due out by 2.0 but hasn't been implemented yet.

 

You could use ./script/console and do something like:

 

%w{ head account_links version }.each do |name|

c = Card.fetch_or_create "*#{name}+*self+*read"

c.content = 'Anyone'

c.save!

end

 

You make then have to clear the cache for it to take effect.

 

rake cache:clear

  --Ethan McCutchen.....Fri Aug 05 15:16:01 -0700 2011


which environment will be used?

 

is is account or account_link I have to change?

  --dermicha.....Fri Aug 05 15:24:30 -0700 2011


you can set env with

 

./script/console -e env_name

env RAILS_ENV=env_name rake cache:clear

 

"*account links" is the one you really want all users to see. that's the card that contains the signin / signup links.

  --Ethan McCutchen.....Fri Aug 05 15:27:56 -0700 2011


./script/console testSystem

 

 

%w{ head account_links version logo}.each do |name|

c = Card.fetch_or_create "*#{name}+*self+*read"

c.content = 'Anyone'

c.save!

end

 

 

Card::PermissionDenied: for card *head+*self+*read: Anonymous, You don't have permission to create this card

from /data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:60:in `run_checked_save'

from /data/var/local/www/wiki/wagn/lib/wagn/model/permissions.rb:42:in `save'

from /var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:727:in `create'

from /data/var/local/www/wiki/wagn/lib/wagn/model/fetch.rb:52:in `fetch_or_create'

from (irb):7

from (irb):6:in `each'

from (irb):6

 

And it is a fresh and clean test system. What is the problem?

  --dermicha.....Fri Aug 05 15:34:29 -0700 2011


1. don't forget the "-e" in the console command

 

2. add this before the above code:

 

User.as :wagbot

 

3. make sure there are brackets in the content:

 

c.content = 'Anyone'

  --Ethan McCutchen.....Fri Aug 05 15:38:10 -0700 2011


sorry, but now I tried it all again in a fresh wagn setup and got that

 

 

>> %w{head account_links version logo}.each do |name|

?> c = Card.fetch_or_create "*#{name}+*self+*read"

>> c.content = 'Anyone'

>> c.save!

>> end

ActiveRecord::RecordNotFound: Couldn't find Revision with ID=5802

from /var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:1620:in `find_one'

from /var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:1603:in `find_from_ids'

from /var/lib/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:620:in `find'

from /data/var/local/www/wiki/wagn/app/models/card.rb:330:in `cached_revision'

from /data/var/local/www/wiki/wagn/app/models/card.rb:316:in `content_without_tracking'

from (eval):13:in `content'

from (eval):3:in `content='

from (irb):30

from (irb):28:in `each'

from (irb):28

>>

 

 

-e does not work in my environment. Without -e the correct env will be used.

 

./script/console -etestSystem

/usr/lib/ruby/1.8/optparse.rb:1445:in `complete': invalid option: -etestSystem (OptionParser::InvalidOption)

from /usr/lib/ruby/1.8/optparse.rb:1443:in `catch'

from /usr/lib/ruby/1.8/optparse.rb:1443:in `complete'

from /usr/lib/ruby/1.8/optparse.rb:1282:in `parse_in_order'

from /usr/lib/ruby/1.8/optparse.rb:1249:in `catch'

from /usr/lib/ruby/1.8/optparse.rb:1249:in `parse_in_order'

from /usr/lib/ruby/1.8/optparse.rb:1243:in `order!'

from /usr/lib/ruby/1.8/optparse.rb:1334:in `permute!'

from /usr/lib/ruby/1.8/optparse.rb:1355:in `parse!'

from /var/lib/gems/1.8/gems/rails-2.3.11/lib/commands/console.rb:11

from /usr/lib/ruby/1.8/optparse.rb:787:in `initialize'

from /var/lib/gems/1.8/gems/rails-2.3.11/lib/commands/console.rb:6:in `new'

from /var/lib/gems/1.8/gems/rails-2.3.11/lib/commands/console.rb:6

from ./script/console:3:in `require'

from ./script/console:3

  --dermicha.....Fri Aug 05 15:56:13 -0700 2011


sorry again, copy & paste had eaten the brackets. I added some spaces before and after the brackets and now it works. great. Thanks!!!

  --dermicha.....Fri Aug 05 15:59:12 -0700 2011