tiny_core_accounts 0.0.1 → 0.0.2

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.
@@ -27,7 +27,7 @@ module TinyCore
27
27
 
28
28
  module InstanceMethods
29
29
  def after_initialize
30
- extend "::Role::Account::#{self.role.classify}".constantize
30
+ extend "::Role::Account::#{self.role.classify}".constantize if self.role
31
31
  end
32
32
 
33
33
  protected
@@ -0,0 +1,17 @@
1
+ module TinyCore
2
+ module Role
3
+ module Account
4
+ module Admin
5
+ include TinyCore::Role
6
+
7
+ def method_missing(method)
8
+ if method.to_s =~ /^can_.*\?$/
9
+ true
10
+ else
11
+ super
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module TinyCore
2
+ module Role
3
+ module Account
4
+ module User
5
+ include TinyCore::Role
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,79 @@
1
+ ---
2
+ de:
3
+ account:
4
+ role:
5
+ admin: Admin
6
+ user: Benutzer
7
+ accounts:
8
+ edit:
9
+ edit_account: "Konto bearbeiten"
10
+ form:
11
+ could_not_create_account: "Konnte Konto nicht erstellen"
12
+ name: Kontoname
13
+ name_hint: "Zum Beispiel der Name Ihrer Organisation. Hinweis: Alle Benutzer des Kontos können alle Funktionstests sehen"
14
+ save_account: "Konto speichern"
15
+ index:
16
+ details: Details
17
+ edit: Bearbeiten
18
+ name: Name
19
+ new_account: "Neues Konto"
20
+ options: Optionen
21
+ info:
22
+ name: Name
23
+ new:
24
+ new_account: "Neues Konto"
25
+ show:
26
+ account: "Konto {{account}}"
27
+ add_existing: "Vorhandenen Benutzer zum Konto hinzufügen"
28
+ add_new: "Neuen Benutzer für Konto registrieren"
29
+ change: Ändern
30
+ name: Name
31
+ options: Optionen
32
+ really_remove_user_from_account: "Wollen Sie wirklich diesen Benutzer vom Konto entfernen?"
33
+ remove: Entfernen
34
+ role: Rolle
35
+ users: Benutzer
36
+ tabs:
37
+ edit: Bearbeiten
38
+ information: Information
39
+ activerecord:
40
+ errors:
41
+ models:
42
+ user_account:
43
+ attributes:
44
+ email:
45
+ not_found: "gehört zu keinem registrierten Benutzer"
46
+ user_id:
47
+ taken: "ist bereits diesem Konto zugeordnet"
48
+ admin:
49
+ accounts:
50
+ edit:
51
+ could_not_update_account: "Konnte das Konto nicht aktualisieren"
52
+ edit_account: "Konto bearbeiten"
53
+ name: Name
54
+ save_account: "Konto speichern"
55
+ index:
56
+ all_accounts: "Alle Konten"
57
+ edit: Bearbeiten
58
+ name: Name
59
+ no_accounts: "Es gibt bisher keine Konten."
60
+ options: Optionen
61
+ users: Benutzer
62
+ show:
63
+ account: "Konto {{account}}"
64
+ no_users: "bisher keine Benutzer"
65
+ users: Benutzer
66
+ tabs:
67
+ edit: Bearbeiten
68
+ information: Information
69
+ flash:
70
+ error:
71
+ assign_roles: "Konnte die Rolle dem Benutzer nicht zuteilen"
72
+ create_account_first: "Sie müssen zuerst einem Konto zugewiesen sein"
73
+ notice:
74
+ assign_roles: "Die Rolle wurde dem Benutzer erfolgreich zugeteilt"
75
+ created_account: "Konto {{account}} wurde erfolgreich erstellt"
76
+ created_user_account: "Benutzer wurde erfolgreich dem Konto hinzugefügt"
77
+ removed_user_account: "Benutzer wurde erfolgreich vom Konto entfernt"
78
+ switched_account: "Erfolgreich zu Konto {{account}} gewechselt"
79
+ updated_account: "Konto {{account}} wurde erfolgreich aktualisiert"
@@ -0,0 +1,79 @@
1
+ ---
2
+ en:
3
+ account:
4
+ role:
5
+ admin: Admin
6
+ user: User
7
+ accounts:
8
+ edit:
9
+ edit_account: "Edit Account"
10
+ form:
11
+ could_not_create_account: "Could not create account"
12
+ name: Name
13
+ name_hint: "For example your organization's name. Note that every user in an account can see all health checks"
14
+ save_account: "Save account"
15
+ index:
16
+ details: Details
17
+ edit: Edit
18
+ name: Name
19
+ new_account: "New Account"
20
+ options: Options
21
+ info:
22
+ name: Name
23
+ new:
24
+ new_account: "New Account"
25
+ show:
26
+ account: "Account {{account}}"
27
+ add_existing: "Add existing user to this account"
28
+ add_new: "Register new user for this account"
29
+ change: Change
30
+ name: Name
31
+ options: Options
32
+ really_remove_user_from_account: "Do you really want to remove the user from this account?"
33
+ remove: Remove
34
+ role: Role
35
+ users: Users
36
+ tabs:
37
+ edit: Edit
38
+ information: Information
39
+ activerecord:
40
+ errors:
41
+ models:
42
+ user_account:
43
+ attributes:
44
+ email:
45
+ not_found: "does not belong to an existing user"
46
+ user_id:
47
+ taken: "is already assigned to this account"
48
+ admin:
49
+ accounts:
50
+ edit:
51
+ could_not_update_account: "Could not update account"
52
+ edit_account: "Edit account"
53
+ name: Name
54
+ save_account: "Save account"
55
+ index:
56
+ all_accounts: "All accounts"
57
+ edit: Edit
58
+ name: Name
59
+ no_accounts: "There are no accounts yet"
60
+ options: Options
61
+ users: Users
62
+ show:
63
+ account: "Account {{account}}"
64
+ no_users: "no users yet"
65
+ users: Users
66
+ tabs:
67
+ edit: Edit
68
+ information: Information
69
+ flash:
70
+ error:
71
+ assign_roles: "Could not assign account role to user"
72
+ create_account_first: "You need to be assigned to an account first"
73
+ notice:
74
+ assign_roles: "Successfully assigned account role to user"
75
+ created_account: "Successfully created account {{account}}"
76
+ created_user_account: "Successfully added this user to the account"
77
+ removed_user_account: "Successfully removed user from this account"
78
+ switched_account: "Successfully switched to account {{account}}"
79
+ updated_account: "Successfully updated account {{account}}"
@@ -4,9 +4,20 @@ class CreateAccounts < ActiveRecord::Migration
4
4
  t.string :name
5
5
  t.timestamps
6
6
  end
7
+
8
+ create_table :user_accounts do |t|
9
+ t.integer :user_id
10
+ t.integer :account_id
11
+ t.string :role, :default => "user"
12
+ t.timestamps
13
+ end
14
+
15
+ add_column :users, :current_account_id, :integer
7
16
  end
8
17
 
9
18
  def self.down
19
+ remove_column :users, :current_account_id
20
+ drop_table :user_accounts
10
21
  drop_table :accounts
11
22
  end
12
23
  end
@@ -0,0 +1,3 @@
1
+ module Role::Account::Admin
2
+ include TinyCore::Role::Account::Admin
3
+ end
@@ -0,0 +1,3 @@
1
+ module Role::Account::User
2
+ include TinyCore::Role::Account::User
3
+ end
@@ -10,8 +10,10 @@ class TinyAccountGenerator < Rails::Generator::Base
10
10
  m.directory 'app/controllers/admin'
11
11
  m.directory 'app/views/accounts'
12
12
  m.directory 'app/views/admin/accounts'
13
+ m.directory 'config/locales'
13
14
  m.directory 'test/unit'
14
15
  m.directory 'test/functional'
16
+ m.directory 'test/functional/admin'
15
17
 
16
18
  # Classes and tests.
17
19
  m.file "account.rb", 'app/models/account.rb'
@@ -21,9 +23,13 @@ class TinyAccountGenerator < Rails::Generator::Base
21
23
  m.file "accounts_controller.rb", 'app/controllers/accounts_controller.rb'
22
24
  m.file "user_accounts_controller.rb", 'app/controllers/user_accounts_controller.rb'
23
25
  m.file "admin_accounts_controller.rb", 'app/controllers/admin/accounts_controller.rb'
24
- m.file "accounts_controller_test.rb", 'test/functional/accounst_controller_test.rb'
25
- m.file "user_accounts_controller_test.rb", 'test/functional/user_accounst_controller_test.rb'
26
- m.file "admin_accounts_controller_test.rb", 'test/functional/admin_accounts_controller_test.rb'
26
+ m.file "accounts_controller_test.rb", 'test/functional/accounts_controller_test.rb'
27
+ m.file "user_accounts_controller_test.rb", 'test/functional/user_accounts_controller_test.rb'
28
+ m.file "admin_accounts_controller_test.rb", 'test/functional/admin/accounts_controller_test.rb'
29
+
30
+ # Locales
31
+ m.file "accounts_en.yml", 'config/locales/accounts_en.yml'
32
+ m.file "accounts_de.yml", 'config/locales/accounts_de.yml'
27
33
 
28
34
  # Views
29
35
  base_dir = File.dirname(__FILE__) + '/templates'
@@ -33,9 +39,7 @@ class TinyAccountGenerator < Rails::Generator::Base
33
39
  end
34
40
 
35
41
  # Migrations
36
- m.migration_template 'create_accounts.rb', 'db/migrate', :migration_file_name => 'create_accounts.rb'
37
- m.migration_template 'create_user_accounts.rb', 'db/migrate', :migration_file_name => 'create_user_accounts.rb'
38
- m.migration_template 'add_current_account_id_to_users.rb', 'db/migrate', :migration_file_name => 'add_current_account_id_to_users.rb'
42
+ m.migration_template 'create_accounts.rb', 'db/migrate', :migration_file_name => 'create_accounts'
39
43
  end
40
44
  end
41
45
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_core_accounts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Kadauke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-27 00:00:00 +02:00
18
+ date: 2010-08-31 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -35,6 +35,8 @@ files:
35
35
  - lib/tiny_core/controllers/application.rb
36
36
  - lib/tiny_core/controllers/user_accounts.rb
37
37
  - lib/tiny_core/has/accounts.rb
38
+ - lib/tiny_core/role/account/admin.rb
39
+ - lib/tiny_core/role/account/user.rb
38
40
  - lib/tiny_core_accounts.rb
39
41
  - rails_generators/tiny_account/templates/account.rb
40
42
  - rails_generators/tiny_account/templates/account_test.rb
@@ -49,7 +51,8 @@ files:
49
51
  - rails_generators/tiny_account/templates/accounts/show.html.erb
50
52
  - rails_generators/tiny_account/templates/accounts_controller.rb
51
53
  - rails_generators/tiny_account/templates/accounts_controller_test.rb
52
- - rails_generators/tiny_account/templates/add_current_account_id_to_users.rb
54
+ - rails_generators/tiny_account/templates/accounts_de.yml
55
+ - rails_generators/tiny_account/templates/accounts_en.yml
53
56
  - rails_generators/tiny_account/templates/admin/accounts/_index.html.erb
54
57
  - rails_generators/tiny_account/templates/admin/accounts/_tabs.html.erb
55
58
  - rails_generators/tiny_account/templates/admin/accounts/edit.html.erb
@@ -58,7 +61,8 @@ files:
58
61
  - rails_generators/tiny_account/templates/admin_accounts_controller.rb
59
62
  - rails_generators/tiny_account/templates/admin_accounts_controller_test.rb
60
63
  - rails_generators/tiny_account/templates/create_accounts.rb
61
- - rails_generators/tiny_account/templates/create_user_accounts.rb
64
+ - rails_generators/tiny_account/templates/role/account/admin.rb
65
+ - rails_generators/tiny_account/templates/role/account/user.rb
62
66
  - rails_generators/tiny_account/templates/user_account.rb
63
67
  - rails_generators/tiny_account/templates/user_account_test.rb
64
68
  - rails_generators/tiny_account/templates/user_accounts_controller.rb
@@ -97,6 +101,6 @@ rubyforge_project:
97
101
  rubygems_version: 1.3.7
98
102
  signing_key:
99
103
  specification_version: 3
100
- summary: Insert description here
104
+ summary: Simple account management based on tiny_core_users
101
105
  test_files: []
102
106
 
@@ -1,9 +0,0 @@
1
- class AddCurrentAccountIdToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :current_account_id, :integer
4
- end
5
-
6
- def self.down
7
- remove_column :users, :current_account_id
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- class CreateUserAccounts < ActiveRecord::Migration
2
- def self.up
3
- create_table :user_accounts do |t|
4
- t.integer :user_id
5
- t.integer :account_id
6
- t.timestamps
7
- end
8
- end
9
-
10
- def self.down
11
- drop_table :user_accounts
12
- end
13
- end