Skip to content

Commit b208028

Browse files
initial FOSS commit
0 parents  commit b208028

File tree

374 files changed

+32129
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+32129
-0
lines changed

Diff for: .env.example

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
APP_ENV=local
2+
APP_DEBUG=false
3+
APP_KEY=Le1Ain5sooCheejaoShixeehe5sohz
4+
5+
DB_HOST=localhost
6+
DB_DATABASE=weinstein
7+
DB_USERNAME=weinstein
8+
DB_PASSWORD=yourpassword
9+
10+
CACHE_DRIVER=file
11+
SESSION_DRIVER=file
12+
QUEUE_DRIVER=sync

Diff for: .gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.less linguist-vendored

Diff for: .gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/vendor
2+
/node_modules
3+
.env
4+
composer.phar
5+
composer.lock
6+
/nbproject
7+
8+
# Generated css
9+
/public/css/bootstrap.css
10+
/public/css/bootstrap-theme.css
11+
/public/css/weinstein.css
12+
13+
# Generated js
14+
/public/js/weinstein.js
15+
/public/js/weinstein.js.map
16+
/app/storage/logs/laravel.log
17+
/app/storage/sessions/
18+
/app/storage/views/
19+
/app/storage/meta/

Diff for: .travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: php
2+
3+
php:
4+
- 5.4
5+
6+
before_script:
7+
- wget http://getcomposer.org/composer.phar
8+
- php composer.phar install --dev
9+
script:
10+
- phpunit

Diff for: Gruntfile.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* global module */
2+
3+
/**
4+
* @author Christoph Wurst <[email protected]>
5+
*
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License,version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
module.exports = function (grunt) {
23+
grunt.initConfig({
24+
uglify: {
25+
options: {
26+
sourceMap: true
27+
},
28+
my_targets: {
29+
files: {
30+
'public/js/weinstein.js': [
31+
'app/client/js/entertab.js',
32+
'app/client/js/retastebutton.js',
33+
'app/client/js/tasterform.js',
34+
'app/client/js/winelist.js'
35+
]
36+
}
37+
}
38+
},
39+
less: {
40+
production: {
41+
files: {
42+
'public/css/weinstein.css': 'app/client/less/weinstein.less',
43+
'public/css/bootstrap.css': 'app/client/less/bootstrap.less',
44+
'public/css/bootstrap-theme.css': 'app/client/less/theme.less'
45+
}
46+
}
47+
},
48+
watch: {
49+
uglify: {
50+
files: [
51+
'app/client/js/entertab.js',
52+
'app/client/js/retastebutton.js',
53+
'app/client/js/tasterform.js',
54+
'app/client/js/winelist.js'
55+
],
56+
tasks: [
57+
'uglify'
58+
]
59+
}
60+
}
61+
});
62+
63+
grunt.loadNpmTasks('grunt-contrib-uglify');
64+
grunt.loadNpmTasks('grunt-contrib-less');
65+
grunt.loadNpmTasks('grunt-contrib-watch');
66+
67+
grunt.registerTask('dev', ['watch']);
68+
grunt.registerTask('default', ['uglify', 'less']);
69+
};

Diff for: PHP_Modules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The following PHP modules are required to run Weinstein:
2+
- phar (composer)
3+
- openssl (composer)
4+
- zip (PHPExcel)
5+
- php5-zlib (PHPExcel)
6+
- mcrypt (Laravel Crpyto)

Diff for: Weinstein/Applicant/AddressValidator.php

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
/**
4+
* @author Christoph Wurst <[email protected]>
5+
*
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License,version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace Weinstein\Applicant;
23+
24+
use Illuminate\Database\Eloquent\Model;
25+
use Weinstein\Support\Validation\Validator as Validator;
26+
27+
class AddressValidator extends Validator {
28+
29+
/**
30+
* Models class name
31+
*
32+
* @var string
33+
*/
34+
protected $modelClass = 'Address';
35+
36+
/**
37+
* Get attribute names
38+
*
39+
* @return array
40+
*/
41+
protected function getAttributeNames() {
42+
return array(
43+
'street' => 'Straße',
44+
'nr' => 'Nr',
45+
'zipcode' => 'PLZ',
46+
'city' => 'Ort'
47+
);
48+
}
49+
50+
/**
51+
* Get rules for creating a new address
52+
*
53+
* @param array $data
54+
* @return array
55+
*/
56+
protected function getCreateRules(array $data) {
57+
return array(
58+
'street' => 'max:100',
59+
'nr' => 'max:20',
60+
'zipcode' => 'required|integer|between:1000,9999',
61+
'city' => 'max:70'
62+
);
63+
}
64+
65+
protected function getUpdateRules(array $data, Model $model = null) {
66+
return $this->getCreateRules($data);
67+
}
68+
69+
}

Diff for: Weinstein/Applicant/ApplicantAccessController.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/**
4+
* @author Christoph Wurst <[email protected]>
5+
*
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License,version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace Weinstein\Applicant;
23+
24+
use App\Applicant;
25+
use App\User;
26+
27+
class ApplicantAccessController {
28+
29+
/**
30+
* Check if given user administrates given applicant
31+
* - directly: user is applicants admin
32+
* - indirectly: user is applicants association admin
33+
*
34+
* @param App\User $user
35+
* @param Applicant $applicant
36+
* @return boolean
37+
*/
38+
public function isAdmin(User $user, Applicant $applicant) {
39+
if ($applicant->wuser_username === $user->username) {
40+
return true;
41+
}
42+
if (!is_null($applicant->association) && $applicant->association->wuser_username === $user->username) {
43+
return true;
44+
}
45+
return false;
46+
}
47+
48+
}

Diff for: Weinstein/Applicant/ApplicantDataProvider.php

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/**
4+
* @author Christoph Wurst <[email protected]>
5+
*
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License,version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace Weinstein\Applicant;
23+
24+
use App\Applicant;
25+
use App\User;
26+
27+
class ApplicantDataProvider {
28+
29+
/**
30+
* Get all applicants
31+
*
32+
* @return \Illuminate\Database\Eloquent\Collection
33+
*/
34+
public function getAllApplicants() {
35+
return Applicant::all();
36+
}
37+
38+
/**
39+
* Get given users administrated applicants
40+
*
41+
* @param App\User $user
42+
* @return \Illuminate\Database\Eloquent\Collection
43+
*/
44+
public function getApplicantsForUser(User $user) {
45+
//direct
46+
$applicants = $user->applicants()->get();
47+
48+
//indirect
49+
foreach ($user->associations()->get() as $association) {
50+
$applicants = $applicants->merge($association->applicants()->get());
51+
}
52+
53+
$applicants->sortBy('id');
54+
return $applicants;
55+
}
56+
57+
}

0 commit comments

Comments
 (0)