Commit 5b8acb9c authored by ZeMKI's avatar ZeMKI
Browse files

Merge branch 'Production'

parents b1e4bb74 7701822e
......@@ -28,7 +28,6 @@ public/mix-manifest.json
.idea/
/resources/lang/
composer.lock
public/vendor/livewire/manifest.json
public/vendor/livewire/livewire.js.map
......
......@@ -14,7 +14,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/barryvdh/reflection-docblock" />
<excludeFolder url="file://$MODULE_DIR$/vendor/brick/math" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dnoegel/php-xdg-base-dir" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
......@@ -120,7 +119,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher-contracts" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/filesystem" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/finder" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-client-contracts" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-kernel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/mime" />
......@@ -144,8 +142,15 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
<excludeFolder url="file://$MODULE_DIR$/vendor/vlucas/phpdotenv" />
<excludeFolder url="file://$MODULE_DIR$/vendor" />
<excludeFolder url="file://$MODULE_DIR$/storage" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dflydev/dot-access-data" />
<excludeFolder url="file://$MODULE_DIR$/vendor/pimple/pimple" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nette/utils" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nette/schema" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/config" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/serializable-closure" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php81" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -11,7 +11,6 @@
<path value="$PROJECT_DIR$/vendor/barryvdh/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/brick/math" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/dnoegel/php-xdg-base-dir" />
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
<path value="$PROJECT_DIR$/vendor/doctrine/dbal" />
<path value="$PROJECT_DIR$/vendor/doctrine/event-manager" />
......@@ -117,7 +116,6 @@
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
<path value="$PROJECT_DIR$/vendor/symfony/http-client-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
<path value="$PROJECT_DIR$/vendor/symfony/mime" />
......@@ -146,6 +144,18 @@
<path value="$PROJECT_DIR$/vendor/spatie/ray" />
<path value="$PROJECT_DIR$/vendor/spatie/laravel-ray" />
<path value="$PROJECT_DIR$/vendor/spatie/backtrace" />
<path value="$PROJECT_DIR$/vendor/zbateson/mail-mime-parser" />
<path value="$PROJECT_DIR$/vendor/zbateson/stream-decorators" />
<path value="$PROJECT_DIR$/vendor/zbateson/mb-wrapper" />
<path value="$PROJECT_DIR$/vendor/doctrine/deprecations" />
<path value="$PROJECT_DIR$/vendor/dflydev/dot-access-data" />
<path value="$PROJECT_DIR$/vendor/pimple/pimple" />
<path value="$PROJECT_DIR$/vendor/nette/utils" />
<path value="$PROJECT_DIR$/vendor/nette/schema" />
<path value="$PROJECT_DIR$/vendor/psr/cache" />
<path value="$PROJECT_DIR$/vendor/league/config" />
<path value="$PROJECT_DIR$/vendor/laravel/serializable-closure" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php81" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7">
......
......@@ -57,6 +57,7 @@ class AllInterviewTokenExport implements FromCollection, WithMapping, WithHeadin
}elseif($this->sorting == 3){
array_push($columnNames, "position column/row");
array_push($columnNames, "position base");
array_push($columnNames, "token description");
$baseArray = [];
$study = Study::where('id',$this->id)->first();
$columns = explode('|separator|', substr($study->sortings[0]->pivot->details, strpos($study->sortings[0]->pivot->details, 'qsort|') + 6));
......@@ -153,6 +154,7 @@ class AllInterviewTokenExport implements FromCollection, WithMapping, WithHeadin
$toPrint["position column/row"] = $position;
$toPrint["position base"] = $this->columnValues[($position[0] - 1)];
$toPrint["token description"] = json_decode($token->properties) ? json_decode($token->properties)->description : '';
$interview = Interview::where('id',$token->interview_id)->first();
$tokenToCheck = Token::where('id', $token->id)->first();
......@@ -160,6 +162,8 @@ class AllInterviewTokenExport implements FromCollection, WithMapping, WithHeadin
{
return $item->detail == "extremeQuestion";
})->first();
$toPrint['Reason for Placement'] = "";
if ($hasExtremeQuestion !== "" && $interview->answers)
{
foreach ($interview->answers as $answer)
......
......@@ -91,6 +91,8 @@ class InterviewQsortExport implements FromCollection, WithMapping, WithHeadings
{
return $item->detail == "extremeQuestion";
})->first();
$tempValuesArray['Reason for Placement'] = "";
if ($hasExtremeQuestion !== "" && $interview->answers)
{
foreach ($interview->answers as $answer)
......@@ -100,6 +102,7 @@ class InterviewQsortExport implements FromCollection, WithMapping, WithHeadings
}
}
return $tempValuesArray;
}
......
......@@ -33,6 +33,15 @@ class AdminController extends Controller
return view('admin.dashboard', $data);
}
public function showStudies()
{
$data['studies'] = Study::all();
return view('admin.studies',$data);
}
public function formatBytes($size, $precision = 2)
{
$base = log($size, 1024);
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Permission;
use App\Role;
use App\Rules\bannedEmails;
use App\User;
use Helper;
use Illuminate\Foundation\Auth\RegistersUsers;
......@@ -54,7 +55,7 @@ class RegisterController extends Controller
protected function validator(array $data)
{
return Validator::make($data, [
'email' => 'required|string|email|max:255|unique:users',
'email' => ['required', new bannedEmails(), 'string', 'email', 'max:255', 'unique:users'],
'password' => 'required|string|min:6|confirmed',
]);
}
......
<?php
namespace App\Rules;
use App\User;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\App;
use Spatie\WebhookServer\WebhookCall;
class bannedEmails implements Rule
{
private $emails = [
'abc@abc.com',
'hello@world.de',
'foo@bar.co.uk',
'hannah_schoeneberg@nu.uni-giessen.de'
];
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if(
in_array($value,$this->emails)){
if (!App::environment('local')) {
WebhookCall::create()
->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->payload(['text' => 'Someone tried to register a banned email: '.$value.' . They have been informed to contact us.'])
->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->dispatch();
}
}
return !in_array($value,$this->emails);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'Your email has been banned. Please contact mesoftware@uni-bremen.de.';
}
}
......@@ -61,7 +61,38 @@ class Token extends Model
else $token->image_path = isset($tokenToSave['file']) ? $tokenToSave['file'] : $tokenToSave['image_path'];
} else
{
self::SaveNewToken($tokenToSave, $study, $isInterview, $token);
// either save new image or use the default
$thereIsImageToUpload = isset($tokenToSave['base64']) || isset($tokenToSave['fileUpload']) || isset($tokenToSave['file']['base64']);
if ($thereIsImageToUpload)
{
if($isInterview) $image = $tokenToSave['file']['base64'];
else $image = isset($tokenToSave['fileUpload']) && $tokenToSave['fileUpload'] != [] ? $tokenToSave['fileUpload']['base64'] : $tokenToSave['base64'];
} else
{
$image = config('utilities.sortingBasicIcon');
}
$name = $tokenToSave['name'];
$arr = explode(',', $image, 2);
$base64FirstPart = $arr[0];
$studyPath = storage_path('app/study' . $study->id . '/tokens/');
File::isDirectory($studyPath) or File::makeDirectory($studyPath, 0775, true, true);
// create a new name if the file with the same name exist
if (file_exists($studyPath . $name . '.mtoken'))
{
$name = now()->timestamp . $name;
}
$extension = Helper::extension($image);
// open file a image resource
$path = $studyPath . $name . "." . $extension;
Image::make($image)->fit(100, 100)->save($path);
$encryptedContent = encrypt($base64FirstPart . ',' . base64_encode(file_get_contents($path)));
$encryptedName = 'study' . $study->id . '/tokens/' . $name . '.mtoken';
// Store the encrypted Content
Storage::put($encryptedName, $encryptedContent);
File::delete($path);
$token = new self();
$token->name = $tokenToSave['name'];
$token->image_path = $encryptedName;
}
if ($isInterview) $token->author = 0;
else $token->author = Auth::user()->id;
......
......@@ -187,7 +187,7 @@ class User extends Authenticatable implements MustVerifyEmail
public function notOwnerNorInvited($study)
{
return auth()->user()->isNot($study->creator()) && !in_array($study->id, auth()->user()->invites()->pluck('study_id')->toArray()) ;
return auth()->user()->isNot($study->creator()) && !auth()->user()->isAdmin() && !in_array($study->id, auth()->user()->invites()->pluck('study_id')->toArray()) ;
}
......
This diff is collapsed.
This diff is collapsed.
{
"private": true,
"scripts": {
"dev": "npm run development",
"dev": "mix",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production && npm run compress",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "mix --production",
"compress": "bread-compressor -s public/css/*.css public/js/*.js"
},
"postcss":{"plugins":{"tailwindcss":"./tailwind.config.js"},"autoprefixer":{}},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/core": "^7.17.4",
"@babel/preset-env": "^7.16.11",
"autoprefixer": "^10.4.2",
"axios": "^0.21.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"bread-compressor-cli": "^1.1.0",
"cross-env": "^6.0.3",
"jquery": "^3.5.0",
"laravel-mix": "^5.0.9",
"laravel-mix-polyfill": "^2.0.0",
"laravel-mix-purgecss": "^4.2.0",
"lodash": "^4.17.20",
"jquery": "^3.6.0",
"laravel-mix": "^6.0.0",
"laravel-mix-polyfill": "^3.0.0",
"laravel-mix-purgecss": "^6.0.0",
"lodash": "^4.17.21",
"popper.js": "^2.0.0-next.4",
"postcss": "^8.4.6",
"postcss-import": "^14.0.2",
"sass": "^1.49.7",
"sass-loader": "^8.0.2",
"vue": "^2.6.12"
"tailwindcss": "^3.0.23",
"vue": "^2.6.14",
"vue-loader": "^15.9.7"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.17.2",
"@mdi/font": "^4.9.95",
"alpinejs": "^2.8.0",
"autoprefixer": "^10.1.0",
"alpinejs": "^2.8.2",
"buefy": "^0.8.20",
"bulma": "^0.9.1",
"bulma": "^0.9.3",
"child_process": "^1.0.2",
"core-js": "^3.8.1",
"core-js": "^3.21.0",
"es6-promise": "^4.2.8",
"fs": "0.0.1-security",
"html-to-image": "latest",
"i": "^0.3.6",
"i": "^0.3.7",
"imagemin": "^7.0.1",
"interactjs": "^1.10.1",
"jsonlint": "^1.6.3",
"laravel-elixir-phpdox": "^0.2.0",
"launch-editor-middleware": "^2.2.1",
"interactjs": "^1.10.11",
"launch-editor-middleware": "^2.3.0",
"moment": "^2.29.1",
"node-sass": "^4.14.1",
"npm": "^6.14.10",
"postcss": "^8.2.1",
"tailwindcss": "^2.0.2",
"vue-material-design-icons": "^4.11.0",
"vue-select": "^3.11.2",
"vue-template-compiler": "^2.6.12",
"node-sass": "^4.0.0",
"vue-material-design-icons": "^4.13.0",
"vue-select": "^3.16.0",
"vue-template-compiler": "^2.6.14",
"vue2-touch-events": "^2.3.2",
"vuex": "^3.6.0"
"vuex": "^3.6.2"
}
}
This diff is collapsed.
{"/livewire.js":"/livewire.js?id=eb510e851dceb24afd36"}
\ No newline at end of file
{"/livewire.js":"/livewire.js?id=940557fc56b15ccb9a2d"}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment