authentasaurus 0.4.14 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/CHANGELIST +3 -0
  2. data/TODO +4 -4
  3. data/app/controllers/areas_controller.rb +2 -1
  4. data/app/controllers/groups_controller.rb +2 -1
  5. data/app/controllers/permissions_controller.rb +2 -1
  6. data/app/controllers/recoveries_controller.rb +2 -1
  7. data/app/controllers/registrations_controller.rb +2 -1
  8. data/app/controllers/sessions_controller.rb +2 -1
  9. data/app/controllers/user_invitations_controller.rb +2 -1
  10. data/app/controllers/users_controller.rb +2 -1
  11. data/app/controllers/validations_controller.rb +2 -1
  12. data/app/models/area.rb +2 -1
  13. data/app/models/group.rb +2 -1
  14. data/app/models/permission.rb +2 -1
  15. data/app/models/recovery.rb +2 -1
  16. data/app/models/session.rb +2 -1
  17. data/app/models/user_invitation.rb +2 -1
  18. data/app/models/validation.rb +2 -1
  19. data/lib/authentasaurus/areas_controller.rb +77 -68
  20. data/lib/authentasaurus/groups_controller.rb +78 -70
  21. data/lib/authentasaurus/models/area.rb +15 -6
  22. data/lib/authentasaurus/models/group.rb +15 -6
  23. data/lib/authentasaurus/models/permission.rb +19 -8
  24. data/lib/authentasaurus/models/recovery.rb +31 -21
  25. data/lib/authentasaurus/models/session.rb +59 -50
  26. data/lib/authentasaurus/models/user_invitation.rb +26 -16
  27. data/lib/authentasaurus/models/validation.rb +25 -15
  28. data/lib/authentasaurus/permissions_controller.rb +78 -69
  29. data/lib/authentasaurus/recoveries_controller.rb +62 -52
  30. data/lib/authentasaurus/registrations_controller.rb +34 -24
  31. data/lib/authentasaurus/sessions_controller.rb +42 -33
  32. data/lib/authentasaurus/user_invitations_controller.rb +36 -27
  33. data/lib/authentasaurus/users_controller.rb +77 -68
  34. data/lib/authentasaurus/validations_controller.rb +38 -28
  35. metadata +7 -6
  36. data/app/controllers/authentasaurus/authentasaurus_controller.rb +0 -2
data/CHANGELIST ADDED
@@ -0,0 +1,3 @@
1
+ =Version 0.4.14 > 0.5.4
2
+
3
+ * Improved inheritance of models by adding _model to all models in the libs folder
data/TODO CHANGED
@@ -1,4 +1,4 @@
1
- * Update views to use the new flash convention
2
- * flash[:notice] for information messages
3
- * flash[:alert] for error messages
4
- * Localize views
1
+ * Update views to use the new flash convention [DONE]
2
+ * flash[:notice] for information messages [DONE]
3
+ * flash[:alert] for error messages [DONE]
4
+ * Localize views [DONE]
@@ -1,4 +1,5 @@
1
- class AreasController < Authentasaurus::AreasController
1
+ class AreasController < ApplicationController
2
+ include Authentasaurus::AreasController
2
3
  require_read :index, :show
3
4
  require_write :new, :create, :edit, :update, :destroy
4
5
  end
@@ -1,4 +1,5 @@
1
- class GroupsController < Authentasaurus::GroupsController
1
+ class GroupsController < ApplicationController
2
+ include Authentasaurus::GroupsController
2
3
  require_read :index, :show
3
4
  require_write :new, :create, :edit, :update, :destroy
4
5
  end
@@ -1,4 +1,5 @@
1
- class PermissionsController < Authentasaurus::PermissionsController
1
+ class PermissionsController < ApplicationController
2
+ include Authentasaurus::PermissionsController
2
3
  require_read :index, :show
3
4
  require_write :new, :create, :edit, :update, :destroy
4
5
  end
@@ -1,2 +1,3 @@
1
- class RecoveriesController < Authentasaurus::RecoveriesController
1
+ class RecoveriesController < ApplicationController
2
+ include Authentasaurus::RecoveriesController
2
3
  end
@@ -1,2 +1,3 @@
1
- class RegistrationsController < Authentasaurus::RegistrationsController
1
+ class RegistrationsController < ApplicationController
2
+ include Authentasaurus::RegistrationsController
2
3
  end
@@ -1,2 +1,3 @@
1
- class SessionsController < Authentasaurus::SessionsController
1
+ class SessionsController < ApplicationController
2
+ include Authentasaurus::SessionsController
2
3
  end
@@ -1,4 +1,5 @@
1
- class UserInvitationsController < Authentasaurus::UserInvitationsController
1
+ class UserInvitationsController < ApplicationController
2
+ include Authentasaurus::UserInvitationsController
2
3
  require_read :index
3
4
  require_write :new, :create, :destroy
4
5
  end
@@ -1,4 +1,5 @@
1
- class UsersController < Authentasaurus::UsersController
1
+ class UsersController < ApplicationController
2
+ include Authentasaurus::UsersController
2
3
  require_read :index, :show
3
4
  require_write :new, :create, :edit, :update, :destroy
4
5
  end
@@ -1,2 +1,3 @@
1
- class ValidationsController < Authentasaurus::ValidationsController
1
+ class ValidationsController < ApplicationController
2
+ include Authentasaurus::ValidationsController
2
3
  end
data/app/models/area.rb CHANGED
@@ -1,2 +1,3 @@
1
- class Area < Authentasaurus::Models::Area
1
+ class Area < ActiveRecord::Base
2
+ include Authentasaurus::Models::Area
2
3
  end
data/app/models/group.rb CHANGED
@@ -1,2 +1,3 @@
1
- class Group < Authentasaurus::Models::Group
1
+ class Group < ActiveRecord::Base
2
+ include Authentasaurus::Models::Group
2
3
  end
@@ -1,2 +1,3 @@
1
- class Permission < Authentasaurus::Models::Permission
1
+ class Permission < ActiveRecord::Base
2
+ include Authentasaurus::Models::Permission
2
3
  end
@@ -1,2 +1,3 @@
1
- class Recovery < Authentasaurus::Models::Recovery
1
+ class Recovery < ActiveRecord::Base
2
+ include Authentasaurus::Models::Recovery
2
3
  end
@@ -1,2 +1,3 @@
1
- class Session < Authentasaurus::Models::Session
1
+ class Session
2
+ include Authentasaurus::Models::Session
2
3
  end
@@ -1,2 +1,3 @@
1
- class UserInvitation < Authentasaurus::Models::UserInvitation
1
+ class UserInvitation < ActiveRecord::Base
2
+ include Authentasaurus::Models::UserInvitation
2
3
  end
@@ -1,2 +1,3 @@
1
- class Validation < Authentasaurus::Models::Validation
1
+ class Validation < ActiveRecord::Base
2
+ include Authentasaurus::Models::Validation
2
3
  end
@@ -1,69 +1,78 @@
1
- class Authentasaurus::AreasController < Authentasaurus::AuthentasaurusController
2
-
3
- def index
4
- @areas= Area.find :all
5
-
6
- respond_to do |format|
7
- format.html
8
- end
9
- end
10
-
11
- def show
12
- @area = Area.find params[:id]
13
-
14
- respond_to do |format|
15
- format.html
16
- end
17
- end
18
-
19
- def new
20
- @area = Area.new
21
-
22
- respond_to do |format|
23
- format.html
24
- end
25
- end
26
-
27
- def create
28
- @area = Area.new params[:area]
29
-
30
- respond_to do |format|
31
- if @area.save
32
- format.html { redirect_to :action=>:index, :notice => "Area Created" }
33
- else
34
- flash.now[:alert] = I18n.t(:create_failed, :scope => [:authentasaurus, :messages, :areas])
35
- format.html { render :new }
36
- end
37
- end
38
- end
39
-
40
- def edit
41
- @area = Area.find params[:id]
42
-
43
- respond_to do |format|
44
- format.html
45
- end
46
- end
47
-
48
- def update
49
- @area = Area.find params[:id]
50
-
51
- respond_to do |format|
52
- if @area.update_attributes(params[:area])
53
- format.html { redirect_to @area, :notice => "Area updated" }
54
- else
55
- flash.now[:alert] = I18n.t(:update_failed, :scope => [:authentasaurus, :messages, :areas])
56
- format.html { render :edit }
57
- end
58
- end
59
- end
60
-
61
- def destroy
62
- @area = Area.find params[:id]
63
- @area.destroy
64
-
65
- respond_to do |format|
66
- format.html { redirect_to :action=>:index }
67
- end
68
- end
1
+ module Authentasaurus::AreasController
2
+ def self.included(base) # :nodoc:
3
+ base.send :extend, ClassMethods
4
+ base.send :include, InstanceMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ end
9
+
10
+ module InstanceMethods
11
+ def index
12
+ @areas= Area.find :all
13
+
14
+ respond_to do |format|
15
+ format.html
16
+ end
17
+ end
18
+
19
+ def show
20
+ @area = Area.find params[:id]
21
+
22
+ respond_to do |format|
23
+ format.html
24
+ end
25
+ end
26
+
27
+ def new
28
+ @area = Area.new
29
+
30
+ respond_to do |format|
31
+ format.html
32
+ end
33
+ end
34
+
35
+ def create
36
+ @area = Area.new params[:area]
37
+
38
+ respond_to do |format|
39
+ if @area.save
40
+ format.html { redirect_to :action=>:index, :notice => "Area Created" }
41
+ else
42
+ flash.now[:alert] = I18n.t(:create_failed, :scope => [:authentasaurus, :messages, :areas])
43
+ format.html { render :new }
44
+ end
45
+ end
46
+ end
47
+
48
+ def edit
49
+ @area = Area.find params[:id]
50
+
51
+ respond_to do |format|
52
+ format.html
53
+ end
54
+ end
55
+
56
+ def update
57
+ @area = Area.find params[:id]
58
+
59
+ respond_to do |format|
60
+ if @area.update_attributes(params[:area])
61
+ format.html { redirect_to @area, :notice => "Area updated" }
62
+ else
63
+ flash.now[:alert] = I18n.t(:update_failed, :scope => [:authentasaurus, :messages, :areas])
64
+ format.html { render :edit }
65
+ end
66
+ end
67
+ end
68
+
69
+ def destroy
70
+ @area = Area.find params[:id]
71
+ @area.destroy
72
+
73
+ respond_to do |format|
74
+ format.html { redirect_to :action=>:index }
75
+ end
76
+ end
77
+ end
69
78
  end
@@ -1,71 +1,79 @@
1
- class Authentasaurus::GroupsController < Authentasaurus::AuthentasaurusController
2
-
3
- def index
4
- @groups = Group.find :all
5
-
6
- respond_to do |format|
7
- format.html
8
- end
9
- end
10
-
11
- def show
12
- @group = Group.find params[:id]
13
-
14
- respond_to do |format|
15
- format.html
16
- end
17
- end
18
-
19
- def new
20
- @group = Group.new
21
-
22
- respond_to do |format|
23
- format.html
24
- end
25
- end
26
-
27
- def create
28
- @group = Group.new params[:group]
29
-
30
- respond_to do |format|
31
- if @group.save
32
- format.html { redirect_to :action=>:index, :notice => "Group created" }
33
- else
34
- flash.now[:alert] = I18n.t(:create_failed, :scope => [:authentasaurus, :messages, :groups])
35
- format.html { render :new }
36
- end
37
- end
38
- end
39
-
40
- def edit
41
- @group = Group.find params[:id]
42
-
43
- respond_to do |format|
44
- format.html
45
- end
46
- end
47
-
48
- def update
49
- @group = Group.find params[:id]
50
-
51
- respond_to do |format|
52
- if @group.update_attributes(params[:group])
53
- format.html { redirect_to @group, :notice => "Group updated" }
54
- else
55
- flash.now[:alert] = I18n.t(:update_failed, :scope => [:authentasaurus, :messages, :groups])
56
- format.html { render :edit }
57
- end
58
- end
59
-
60
- end
61
-
62
- def destroy
63
- @group = Group.find params[:id]
64
- @group.destroy
65
-
66
- respond_to do |format|
67
- format.html { redirect_to :action=>:index }
68
- end
69
- end
70
-
1
+ module Authentasaurus::GroupsController
2
+ def self.included(base) # :nodoc:
3
+ base.send :extend, ClassMethods
4
+ base.send :include, InstanceMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ end
9
+
10
+ module InstanceMethods
11
+ def index
12
+ @groups = Group.find :all
13
+
14
+ respond_to do |format|
15
+ format.html
16
+ end
17
+ end
18
+
19
+ def show
20
+ @group = Group.find params[:id]
21
+
22
+ respond_to do |format|
23
+ format.html
24
+ end
25
+ end
26
+
27
+ def new
28
+ @group = Group.new
29
+
30
+ respond_to do |format|
31
+ format.html
32
+ end
33
+ end
34
+
35
+ def create
36
+ @group = Group.new params[:group]
37
+
38
+ respond_to do |format|
39
+ if @group.save
40
+ format.html { redirect_to :action=>:index, :notice => "Group created" }
41
+ else
42
+ flash.now[:alert] = I18n.t(:create_failed, :scope => [:authentasaurus, :messages, :groups])
43
+ format.html { render :new }
44
+ end
45
+ end
46
+ end
47
+
48
+ def edit
49
+ @group = Group.find params[:id]
50
+
51
+ respond_to do |format|
52
+ format.html
53
+ end
54
+ end
55
+
56
+ def update
57
+ @group = Group.find params[:id]
58
+
59
+ respond_to do |format|
60
+ if @group.update_attributes(params[:group])
61
+ format.html { redirect_to @group, :notice => "Group updated" }
62
+ else
63
+ flash.now[:alert] = I18n.t(:update_failed, :scope => [:authentasaurus, :messages, :groups])
64
+ format.html { render :edit }
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ def destroy
71
+ @group = Group.find params[:id]
72
+ @group.destroy
73
+
74
+ respond_to do |format|
75
+ format.html { redirect_to :action=>:index }
76
+ end
77
+ end
78
+ end
71
79
  end
@@ -1,8 +1,17 @@
1
- class Authentasaurus::Models::Area < ActiveRecord::Base
2
- has_many :permissions, :dependent => :destroy
3
- has_many :groups, :through => :permissions
4
-
5
- # Check that everything is there
6
- validates_presence_of :name
1
+ module Authentasaurus::Models::Area
2
+ def self.included(base) # :nodoc:
3
+ base.send :extend, ClassMethods
4
+ base.send :include, InstanceMethods
5
+
6
+ base.send :has_many, :permissions, :dependent => :destroy
7
+ base.send :has_many, :groups, :through => :permissions
8
+
9
+ base.send :validates_presence_of, :name
10
+ end
7
11
 
12
+ module ClassMethods
13
+ end
14
+
15
+ module InstanceMethods
16
+ end
8
17
  end