<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/models/role.rb</filename>
    </added>
    <added>
      <filename>app/views/layouts/home.html.erb</filename>
    </added>
    <added>
      <filename>app/views/layouts/schedule.html.erb</filename>
    </added>
    <added>
      <filename>db/migrate/20091019234058_create_roles.rb</filename>
    </added>
    <added>
      <filename>test/fixtures/roles.yml</filename>
    </added>
    <added>
      <filename>test/unit/role_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -6,7 +6,7 @@ class ApplicationController &lt; ActionController::Base
   protect_from_forgery # See ActionController::RequestForgeryProtection for details\
   filter_parameter_logging :password
   before_filter :set_current_event
-  helper_method :current_event, :admin?, :current_user
+  helper_method :current_event, :current_user, :is_admin?
 
    def current_event
      set_current_event
@@ -14,18 +14,16 @@ class ApplicationController &lt; ActionController::Base
   
   protected
 
-  def authorize
-    unless admin?
-      flash[:error] = &quot;unauthorized access&quot;
-      redirect_to '/login'
-      false
+  def is_admin?
+    if current_user &amp;&amp; current_event
+        current_event.admins.find current_user
+    else
+        flash[:error] = &quot;unauthorized access&quot;
+        redirect_to login_path
+        false
     end
   end
 
-  def admin?
-    session[:password] == 'hcb0s'
-  end 
-
   def is_iphone?
       request.user_agent =~ /(Mobile\/.+Safari)/
   end
@@ -38,7 +36,7 @@ class ApplicationController &lt; ActionController::Base
   private
   
   def set_current_event
-    @current_event ||= Event.find_by_short_name!(request.subdomains.last)
+    @current_event ||= Event.find_by_short_name(request.subdomains.last)
   end
 
   def current_user_session</diff>
      <filename>app/controllers/application_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class HomeController &lt; ApplicationController
   skip_before_filter :set_current_event
+
   def index
   end
 </diff>
      <filename>app/controllers/home_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ class PresentationsController &lt; ApplicationController
     @comment = Comment.new
         
     respond_to do |format|
-      format.html { render :layout=&gt;&quot;application&quot; }# show.html.erb
+      format.html { render :layout=&gt;&quot;schedule&quot; }# show.html.erb
       format.xml  { render :xml =&gt; @presentation }
     end
   end</diff>
      <filename>app/controllers/presentations_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class ScheduleController &lt; ApplicationController
-  before_filter :is_iphone?, :authorize, :only =&gt; :admin
+  before_filter :is_iphone?
+  before_filter :is_admin?, :only =&gt; :admin
   before_filter :setup_selected_day
 
   def setup_selected_day</diff>
      <filename>app/controllers/schedule_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 class UserSessionsController &lt; ApplicationController
+    
   def new
     @user_session = UserSession.new
   end</diff>
      <filename>app/controllers/user_sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,10 @@ class Event &lt; ActiveRecord::Base
   has_many :timeslots
   has_many :rooms
   has_many :presentations
-  
+  has_many :roles  
+  has_many :users, :through =&gt; :roles
+  has_many :admins, :through =&gt; :roles, :source =&gt; :user, :conditions =&gt; &quot;role_type = '#{Role::TYPE_ADMIN}'&quot; 
+
   def schedule(selected_day = nil)
     slots = []
     if selected_day</diff>
      <filename>app/models/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
 class User &lt; ActiveRecord::Base
   acts_as_authentic
+  has_many :roles  
+  has_many :events, :through =&gt; :roles
 end</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,7 @@
+&lt;% content_for :title do %&gt;
+    &lt;%= current_event.name %&gt;                
+&lt;% end %&gt;
+
 &lt;table class=&quot;schedule&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;
   &lt;%=render :partial=&gt;current_event.rotation_columns%&gt;
   &lt;% render :layout =&gt;current_event.rotation_rows do %&gt;</diff>
      <filename>app/views/schedule/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -5,13 +5,14 @@ ActionController::Routing::Routes.draw do |map|
   map.resources :presentations
   map.resources :timeslots
   map.resources :rooms
-  map.home '', :controller =&gt; 'schedule', :action =&gt; 'index'
   map.login 'login', :controller =&gt; 'user_sessions', :action =&gt; 'new'
   map.logout 'logout', :controller =&gt; 'user_sessions', :action =&gt; 'destroy'
   map.iphone 'iphone', :controller=&gt;'schedule', :action=&gt;'iphone'
   map.mobile 'mobile', :controller=&gt;'schedule', :action=&gt;'mobile'
-  map.root :controller =&gt; 'schedule', :conditions =&gt; { :subdomain =&gt; /.+/ }
-  map.root :controller =&gt; 'home', :conditions =&gt; { :subdomain =&gt; 'www' }
+  map.home '', :controller =&gt; 'home', :action =&gt; 'index', :conditions=&gt;{:subdomain=&gt;'www'}
+  map.home '', :controller =&gt; 'schedule', :action =&gt; 'index'
+  map.root :controller =&gt; 'home', :action =&gt; 'index', :conditions=&gt;{:subdomain=&gt;'www'}
+  map.root :controller =&gt; 'schedule'
   map.connect ':controller/:action/:id'
   map.connect ':controller/:action/:id.:format'
 end</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 20091017152052) do
+ActiveRecord::Schema.define(:version =&gt; 20091019234058) do
 
   create_table &quot;comments&quot;, :force =&gt; true do |t|
     t.integer  &quot;presentation_id&quot;
@@ -48,6 +48,14 @@ ActiveRecord::Schema.define(:version =&gt; 20091017152052) do
 
   add_index &quot;presentations&quot;, [&quot;room_id&quot;, &quot;timeslot_id&quot;], :name =&gt; &quot;index_presentations_on_room_id_and_timeslot_id&quot;, :unique =&gt; true
 
+  create_table &quot;roles&quot;, :force =&gt; true do |t|
+    t.integer  &quot;user_id&quot;
+    t.integer  &quot;event_id&quot;
+    t.string   &quot;role_type&quot;
+    t.datetime &quot;created_at&quot;
+    t.datetime &quot;updated_at&quot;
+  end
+
   create_table &quot;rooms&quot;, :force =&gt; true do |t|
     t.string   &quot;name&quot;
     t.string   &quot;location&quot;</diff>
      <filename>db/schema.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/views/layouts/application.html.erb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>ab2853b506a7f958ed053b849673442ead64c3c1</id>
    </parent>
  </parents>
  <author>
    <name>Carl Leiby</name>
    <email>carl.leiby@gmail.com</email>
  </author>
  <url>http://github.com/carlism/barcamp_schedule/commit/52717b022fdb58180f00e578511deae9b584b7d8</url>
  <id>52717b022fdb58180f00e578511deae9b584b7d8</id>
  <committed-date>2009-10-19T17:51:12-07:00</committed-date>
  <authored-date>2009-10-19T17:51:12-07:00</authored-date>
  <message>Added roles and got the routes file working for the www domain</message>
  <tree>1b666f1bf2704d9b3c953f73fdd903d6f3035782</tree>
  <committer>
    <name>Carl Leiby</name>
    <email>carl.leiby@gmail.com</email>
  </committer>
</commit>
