trust 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +23 -0
- data/README.md +244 -0
- data/Rakefile +37 -0
- data/lib/tasks/trust_tasks.rake +42 -0
- data/lib/trust/active_record.rb +65 -0
- data/lib/trust/authorization.rb +85 -0
- data/lib/trust/controller/properties.rb +134 -0
- data/lib/trust/controller/resource.rb +306 -0
- data/lib/trust/controller.rb +197 -0
- data/lib/trust/exceptions.rb +45 -0
- data/lib/trust/inheritable_attribute.rb +91 -0
- data/lib/trust/permissions.rb +268 -0
- data/lib/trust/test_helper.rb +56 -0
- data/lib/trust/version.rb +27 -0
- data/lib/trust.rb +39 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/accounts.js +2 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/clients.js +2 -0
- data/test/dummy/app/assets/javascripts/users.js +2 -0
- data/test/dummy/app/assets/stylesheets/accounts.css +4 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/clients.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/assets/stylesheets/users.css +4 -0
- data/test/dummy/app/controllers/accounts_controller.rb +100 -0
- data/test/dummy/app/controllers/application_controller.rb +31 -0
- data/test/dummy/app/controllers/clients_controller.rb +107 -0
- data/test/dummy/app/controllers/savings_accounts_controller.rb +27 -0
- data/test/dummy/app/controllers/settlements_controller.rb +26 -0
- data/test/dummy/app/controllers/users_controller.rb +107 -0
- data/test/dummy/app/helpers/accounts_helper.rb +26 -0
- data/test/dummy/app/helpers/application_helper.rb +26 -0
- data/test/dummy/app/helpers/clients_helper.rb +26 -0
- data/test/dummy/app/helpers/users_helper.rb +26 -0
- data/test/dummy/app/models/account/credit.rb +26 -0
- data/test/dummy/app/models/account.rb +35 -0
- data/test/dummy/app/models/client.rb +35 -0
- data/test/dummy/app/models/permissions.rb +68 -0
- data/test/dummy/app/models/savings_account.rb +26 -0
- data/test/dummy/app/models/user.rb +40 -0
- data/test/dummy/app/views/accounts/_form.html.erb +46 -0
- data/test/dummy/app/views/accounts/edit.html.erb +31 -0
- data/test/dummy/app/views/accounts/index.html.erb +48 -0
- data/test/dummy/app/views/accounts/new.html.erb +30 -0
- data/test/dummy/app/views/accounts/show.html.erb +35 -0
- data/test/dummy/app/views/clients/_form.html.erb +46 -0
- data/test/dummy/app/views/clients/edit.html.erb +31 -0
- data/test/dummy/app/views/clients/index.html.erb +48 -0
- data/test/dummy/app/views/clients/new.html.erb +30 -0
- data/test/dummy/app/views/clients/show.html.erb +35 -0
- data/test/dummy/app/views/layouts/application.html.erb +39 -0
- data/test/dummy/app/views/users/_form.html.erb +46 -0
- data/test/dummy/app/views/users/edit.html.erb +31 -0
- data/test/dummy/app/views/users/index.html.erb +48 -0
- data/test/dummy/app/views/users/new.html.erb +30 -0
- data/test/dummy/app/views/users/show.html.erb +35 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +38 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20120522115011_create_accounts.rb +36 -0
- data/test/dummy/db/migrate/20120522130322_create_users.rb +33 -0
- data/test/dummy/db/migrate/20120523144144_create_clients.rb +34 -0
- data/test/dummy/db/schema.rb +38 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/accounts.yml +7 -0
- data/test/dummy/test/fixtures/clients.yml +7 -0
- data/test/dummy/test/fixtures/users.yml +7 -0
- data/test/dummy/test/functional/accounts_controller_test.rb +123 -0
- data/test/dummy/test/functional/clients_controller_test.rb +74 -0
- data/test/dummy/test/functional/users_controller_test.rb +74 -0
- data/test/dummy/test/unit/account_test.rb +31 -0
- data/test/dummy/test/unit/client_test.rb +31 -0
- data/test/dummy/test/unit/helpers/accounts_helper_test.rb +28 -0
- data/test/dummy/test/unit/helpers/clients_helper_test.rb +28 -0
- data/test/dummy/test/unit/helpers/users_helper_test.rb +28 -0
- data/test/dummy/test/unit/permissions_test.rb +171 -0
- data/test/dummy/test/unit/user_test.rb +31 -0
- data/test/test_helper.rb +45 -0
- data/test/trust_test.rb +31 -0
- data/test/unit/trust/active_record_test.rb +56 -0
- data/test/unit/trust/authorization_test.rb +108 -0
- data/test/unit/trust/controller/properties_test.rb +132 -0
- data/test/unit/trust/controller/resource_test.rb +251 -0
- data/test/unit/trust/controller_test.rb +160 -0
- data/test/unit/trust/inheritable_attribute_test.rb +65 -0
- data/test/unit/trust/permissions_test.rb +258 -0
- metadata +280 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class AccountsController < ApplicationController
|
26
|
+
|
27
|
+
belongs_to :client
|
28
|
+
|
29
|
+
# GET /clients/1/accounts
|
30
|
+
# GET /clients/1/accounts.json
|
31
|
+
def index
|
32
|
+
@accounts = resource.relation.all
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html # index.html.erb
|
36
|
+
format.json { render json: @accounts }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# GET /clients/1/accounts/1
|
41
|
+
# GET /clients/1/accounts/1.json
|
42
|
+
def show
|
43
|
+
respond_to do |format|
|
44
|
+
format.html # show.html.erb
|
45
|
+
format.json { render json: @account }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# GET /clients/1/accounts/new
|
50
|
+
# GET /clients/1/accounts/new.json
|
51
|
+
def new
|
52
|
+
respond_to do |format|
|
53
|
+
format.html # new.html.erb
|
54
|
+
format.json { render json: @account }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# GET /clients/1/accounts/1/edit
|
59
|
+
def edit
|
60
|
+
end
|
61
|
+
|
62
|
+
# POST /clients/1/accounts
|
63
|
+
# POST /clients/1/accounts.json
|
64
|
+
def create
|
65
|
+
respond_to do |format|
|
66
|
+
if @account.save
|
67
|
+
format.html { redirect_to client_account_path(@account.client,@account), notice: 'Account was successfully created.' }
|
68
|
+
format.json { render json: @account, status: :created, location: @account }
|
69
|
+
else
|
70
|
+
format.html { render action: "new" }
|
71
|
+
format.json { render json: @account.errors, status: :unprocessable_entity }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# PUT /clients/1/accounts/1
|
77
|
+
# PUT /clients/1/accounts/1.json
|
78
|
+
def update
|
79
|
+
respond_to do |format|
|
80
|
+
if @account.update_attributes(params[:account])
|
81
|
+
format.html { redirect_to client_account_path(@account), notice: 'Account was successfully updated.' }
|
82
|
+
format.json { head :no_content }
|
83
|
+
else
|
84
|
+
format.html { render action: "edit" }
|
85
|
+
format.json { render json: @account.errors, status: :unprocessable_entity }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# DELETE /clients/1/accounts/1
|
91
|
+
# DELETE /clients/1/accounts/1.json
|
92
|
+
def destroy
|
93
|
+
@account.destroy
|
94
|
+
|
95
|
+
respond_to do |format|
|
96
|
+
format.html { redirect_to client_accounts_url }
|
97
|
+
format.json { head :no_content }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class ApplicationController < ActionController::Base
|
26
|
+
protect_from_forgery
|
27
|
+
trustee
|
28
|
+
|
29
|
+
attr_accessor :current_user
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class ClientsController < ApplicationController
|
26
|
+
# GET /clients
|
27
|
+
# GET /clients.json
|
28
|
+
def index
|
29
|
+
@clients = Client.all
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html # index.html.erb
|
33
|
+
format.json { render json: @clients }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# GET /clients/1
|
38
|
+
# GET /clients/1.json
|
39
|
+
def show
|
40
|
+
@client = Client.find(params[:id])
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
format.html # show.html.erb
|
44
|
+
format.json { render json: @client }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /clients/new
|
49
|
+
# GET /clients/new.json
|
50
|
+
def new
|
51
|
+
@client = Client.new
|
52
|
+
|
53
|
+
respond_to do |format|
|
54
|
+
format.html # new.html.erb
|
55
|
+
format.json { render json: @client }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# GET /clients/1/edit
|
60
|
+
def edit
|
61
|
+
@client = Client.find(params[:id])
|
62
|
+
end
|
63
|
+
|
64
|
+
# POST /clients
|
65
|
+
# POST /clients.json
|
66
|
+
def create
|
67
|
+
@client = Client.new(params[:client])
|
68
|
+
|
69
|
+
respond_to do |format|
|
70
|
+
if @client.save
|
71
|
+
format.html { redirect_to @client, notice: 'Client was successfully created.' }
|
72
|
+
format.json { render json: @client, status: :created, location: @client }
|
73
|
+
else
|
74
|
+
format.html { render action: "new" }
|
75
|
+
format.json { render json: @client.errors, status: :unprocessable_entity }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# PUT /clients/1
|
81
|
+
# PUT /clients/1.json
|
82
|
+
def update
|
83
|
+
@client = Client.find(params[:id])
|
84
|
+
|
85
|
+
respond_to do |format|
|
86
|
+
if @client.update_attributes(params[:client])
|
87
|
+
format.html { redirect_to @client, notice: 'Client was successfully updated.' }
|
88
|
+
format.json { head :no_content }
|
89
|
+
else
|
90
|
+
format.html { render action: "edit" }
|
91
|
+
format.json { render json: @client.errors, status: :unprocessable_entity }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# DELETE /clients/1
|
97
|
+
# DELETE /clients/1.json
|
98
|
+
def destroy
|
99
|
+
@client = Client.find(params[:id])
|
100
|
+
@client.destroy
|
101
|
+
|
102
|
+
respond_to do |format|
|
103
|
+
format.html { redirect_to clients_url }
|
104
|
+
format.json { head :no_content }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class SavingsAccountsController < AccountsController
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class SettlementsController < ApplicationController
|
26
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class UsersController < ApplicationController
|
26
|
+
# GET /users
|
27
|
+
# GET /users.json
|
28
|
+
def index
|
29
|
+
@users = User.all
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html # index.html.erb
|
33
|
+
format.json { render json: @users }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# GET /users/1
|
38
|
+
# GET /users/1.json
|
39
|
+
def show
|
40
|
+
@user = User.find(params[:id])
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
format.html # show.html.erb
|
44
|
+
format.json { render json: @user }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /users/new
|
49
|
+
# GET /users/new.json
|
50
|
+
def new
|
51
|
+
@user = User.new
|
52
|
+
|
53
|
+
respond_to do |format|
|
54
|
+
format.html # new.html.erb
|
55
|
+
format.json { render json: @user }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# GET /users/1/edit
|
60
|
+
def edit
|
61
|
+
@user = User.find(params[:id])
|
62
|
+
end
|
63
|
+
|
64
|
+
# POST /users
|
65
|
+
# POST /users.json
|
66
|
+
def create
|
67
|
+
@user = User.new(params[:user])
|
68
|
+
|
69
|
+
respond_to do |format|
|
70
|
+
if @user.save
|
71
|
+
format.html { redirect_to @user, notice: 'User was successfully created.' }
|
72
|
+
format.json { render json: @user, status: :created, location: @user }
|
73
|
+
else
|
74
|
+
format.html { render action: "new" }
|
75
|
+
format.json { render json: @user.errors, status: :unprocessable_entity }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# PUT /users/1
|
81
|
+
# PUT /users/1.json
|
82
|
+
def update
|
83
|
+
@user = User.find(params[:id])
|
84
|
+
|
85
|
+
respond_to do |format|
|
86
|
+
if @user.update_attributes(params[:user])
|
87
|
+
format.html { redirect_to @user, notice: 'User was successfully updated.' }
|
88
|
+
format.json { head :no_content }
|
89
|
+
else
|
90
|
+
format.html { render action: "edit" }
|
91
|
+
format.json { render json: @user.errors, status: :unprocessable_entity }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# DELETE /users/1
|
97
|
+
# DELETE /users/1.json
|
98
|
+
def destroy
|
99
|
+
@user = User.find(params[:id])
|
100
|
+
@user.destroy
|
101
|
+
|
102
|
+
respond_to do |format|
|
103
|
+
format.html { redirect_to users_url }
|
104
|
+
format.json { head :no_content }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
module AccountsHelper
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
module ApplicationHelper
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
module ClientsHelper
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
module UsersHelper
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class Account::Credit < Account
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class Account < ActiveRecord::Base
|
26
|
+
attr_accessible :name, :client_id
|
27
|
+
belongs_to :client
|
28
|
+
belongs_to :created_by, :class_name => 'User'
|
29
|
+
|
30
|
+
before_create :set_owner
|
31
|
+
|
32
|
+
def set_owner
|
33
|
+
self.created_by = User.current
|
34
|
+
end
|
35
|
+
end
|