admin role was not correctly set when creating a new website

This commit is contained in:
did 2011-07-05 11:56:24 +02:00
parent 00fd00240f
commit 71d7e86acd
7 changed files with 64 additions and 4 deletions

View File

@ -7,7 +7,7 @@ module Admin
def create
@site = Site.new(params[:site])
@site.memberships.build :account => @current_admin, :admin => true
@site.memberships.build :account => @current_admin, :role => 'admin'
create! { edit_admin_my_account_url }
end

View File

@ -3,7 +3,6 @@ class Membership
include Locomotive::Mongoid::Document
## fields ##
# field :admin, :type => Boolean, :default => false
field :role, :default => 'author'
## associations ##

View File

@ -65,7 +65,10 @@ x export site
x rake task to import a remote template
x MERGE
x remove withelist for assets since we've got now roles
- admin role is not correctly set when creating a new website
- test and/or convert existing templates (the 2 of the themes section)
- the required star for file field is not shown
- tooltip to explain the difference between 1.) Admin 2.) Author 3.) Designer?
- overide sort for contents
- icon for redirection page in the pages section (back-office)
@ -93,7 +96,7 @@ BACKLOG:
- dev -> staging -> production
- sync data
- import only theme assets
- endless pagination
REFACTORING:

View File

@ -0,0 +1,27 @@
Here is a pretty exhaustive list of what the BIG MERGE includes:
- upgrade the list of gems: Rails 3.0.9, Devise 1.3.4, Rake 0.9.2, ...etc
- roles with the CanCan gem
note: 3 kind of roles. Administrator (they can do everything), Designer (like Administrator but applied on a single website), Author (only edit pages and contents)
- resizing images on the fly (ticket #79)
- tinyMCE enhancements (ticket #99):
- the locomotive image plugin has been replaced by the locomotive media plugin which allows you to upload any kind of files
- fullscreen mode, very convenient to edit a long text
- remove asset_collections:
note: the asset collections tab was confusing for users (and me too). Actually, it's like a content type with a different kind of view in the back-office (the galery view is not implemented yet)
- use dashes instead of underscores (ticket #56)
note: pages (slug) and contents (permalink) uses the parameterize String method.
- SEO (tickets #57 & #90)
- index and index/ are the same page now (301 redirection)
- add a seo_title for both the site, the page and content objects.
- write a {% seo %} liquid tag to display the title, meta (description and keywords) tags depending on the context
- fix issue about httparty (ticket #91)
- check if custom contents are organized in a category when displaying the select box for the has_one / has_many fields
- add 2 liquid global variables in the page conext: current time and date. Dates from a custom content are now comparable
- site export (but editable_elements inside a page are not correctly handled for now)
- rake task to import a remote template
- UI tweaks, a quick list of some of them
- better hints for the theme asset new/edit action
- slight modifications on forms: separator between fields, text shadow, error message redesigned, ...etc
- quick link to edit directly a model from the submenu
- a lot of internal refactoring as well as a ton of bug corrections

View File

@ -0,0 +1,23 @@
Feature: Manage my site
In order to manage my site
As an administrator
I want to edit/delete my site
Background:
Given I have the site: "test site" set up
And I am an authenticated user
Scenario: Site settings are not accessible for non authenticated accounts
Given I am not authenticated
When I go to the site settings
Then I should see "Log in"
Scenario: Add a new site
Given I go to the account settings
And I follow "new site"
Then I should see "Fill in the form below to create your new site."
When I fill in "Name" with "Acme"
And I fill in "Subdomain" with "acme"
And I press "Create"
Then I should see "Site was successfully created."
And I should be a administrator of the "Acme" site

View File

@ -15,4 +15,10 @@ end
Given /^I have a designer and an author$/ do
Factory(:designer, :site => Site.first)
Factory(:author, :site => Site.first)
end
end
Then /^I should be a administrator of the "([^"]*)" site$/ do |name|
site = Site.where(:name => name).first
m = site.memberships.detect { |m| m.account_id == @admin._id && m.admin? }
m.should_not be_nil
end

View File

@ -25,6 +25,8 @@ module NavigationHelpers
admin_theme_assets_path
when /site settings/
edit_admin_current_site_path
when /account settings/
edit_admin_my_account_path
when /import page/
new_admin_import_path
when /export page/