Skip to content

Commit

Permalink
Merge pull request #21 from harish81/digidocu_next
Browse files Browse the repository at this point in the history
fix permission issues. improve upload workflow.
  • Loading branch information
harish81 committed Oct 13, 2021
2 parents a343974 + c5487aa commit 787e1d6
Show file tree
Hide file tree
Showing 3 changed files with 2,924 additions and 1,211 deletions.
11 changes: 9 additions & 2 deletions app/Http/Controllers/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function show($id)
$this->authorize('view', $document);

$missigDocMsgs = $this->documentRepository->buildMissingDocErrors($document);
$dataToRet = compact('document', 'missigDocMsgs');

if (auth()->user()->can('user manage permission')) {
$users = User::where('id', '!=', 1)->get();
Expand All @@ -140,8 +141,10 @@ public function show($id)
$tagWisePermList = $this->permissionRepository->getTagWiseUsersPermissionsForDoc($document);
//Global Permission
$globalPermissionUsers = $this->permissionRepository->getGlobalPermissionsForDoc($document);

$dataToRet = array_merge($dataToRet, compact('users', 'thisDocPermissionUsers', 'tagWisePermList', 'globalPermissionUsers'));
}
return view('documents.show', compact('document', 'missigDocMsgs', 'users', 'thisDocPermissionUsers', 'tagWisePermList', 'globalPermissionUsers'));
return view('documents.show', $dataToRet);
}

public function storePermission($id, Request $request)
Expand Down Expand Up @@ -242,7 +245,11 @@ public function verify($id, Request $request)

public function showUploadFilesUi($id)
{
$document = Document::findOrFail($id);
$document = Document::find($id);
if(empty($document)){
Flash::error("Oh No..., try to create some ".config('settings.document_label_singular')." before uploading ".config('settings.file_label_plural'));
return redirect()->route('documents.index');
}
$this->authorize('update', [$document, $document->tags->pluck('id')]);
$fileTypes = FileType::pluck('name', 'id');
$customFields = $this->customFieldRepository->getForModel('files');
Expand Down

0 comments on commit 787e1d6

Please sign in to comment.