public
Fork of mleung/feather
Description: The simplest blog that works. Make sure you check out the feather-plugins repo as well!
Homepage:
Clone URL: git://github.com/bond/feather.git
Created support for roles based on ticket: 
http://feather.lighthouseapp.com/projects/10532/tickets/21-support-for-non-admin
-users-roles#ticket-21-4
  - added admin :role to first User
  - modified Admin::Dashboard::Base to use admin_required instead of 
  login-required (as introduced to merb-auth)
  - added method to delete a User
Daniel Bond (author)
Sat Jul 19 19:11:22 -0700 2008
commit  0339af9ebe48627e950962ed6af1fded70f76bd4
tree    0a4d8d6135ab7b012081893aa4e5a4eebd4059c6
parent  d9fdcdc6d8770b111dbf9df8835d92c89aeec166
...
1
2
3
4
 
5
6
...
1
2
3
 
4
5
6
0
@@ -1,6 +1,6 @@
0
 module Admin
0
   class Base < Application
0
     layout :admin
0
-    before :login_required
0
+    before :admin_required
0
   end
0
 end
...
13
14
15
16
 
17
18
19
20
 
21
22
23
...
13
14
15
 
16
17
18
19
 
20
21
22
23
0
@@ -13,11 +13,11 @@ module Admin
0
       # This checks to see if there are no users (such as when it's a fresh install) - if so, it creates a default user and redirects the user to login with those details
0
       def check_for_user
0
         if User.count == 0
0
-          User.create({:login => "admin", :password => "password", :password_confirmation => "password", :name => 'blog owner', :email => "none@none", :time_zone => "Europe/London"})
0
+          User.create({:login => "admin", :role => "admin", :password => "password", :password_confirmation => "password", :name => 'blog owner', :email => "none@none", :time_zone => "Europe/London"})
0
           # Display the newly created users details
0
           notify "No users found, so default user created: authenticate with login \"admin\", password \"password\", and then change your password."
0
         end
0
-        login_required
0
+        admin_required
0
       end
0
   end
0
 end
...
12
13
14
15
 
 
 
 
 
 
 
16
17
18
...
12
13
14
 
15
16
17
18
19
20
21
22
23
24
0
@@ -12,7 +12,13 @@ module MerbAuth
0
 
0
     def edit
0
       @user = User.get(params[:id])
0
-      display @user      
0
+      display @user
0
+    end
0
+    
0
+    def delete(id)
0
+      @user = User[id]
0
+      @user.destroy
0
+      redirect(url(:users))
0
     end
0
 
0
     def update

Comments