mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-25 17:57:28 +08:00
Started work on user profile pages
This commit is contained in:
parent
293be7093c
commit
4442a2e6d1
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Activity;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
@ -92,10 +93,9 @@ class UserController extends Controller
|
|||
$user->save();
|
||||
}
|
||||
|
||||
return redirect('/users');
|
||||
return redirect('/settings/users');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified user.
|
||||
* @param int $id
|
||||
|
@ -159,7 +159,7 @@ class UserController extends Controller
|
|||
}
|
||||
|
||||
$user->save();
|
||||
return redirect('/users');
|
||||
return redirect('/settings/users');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,6 +197,19 @@ class UserController extends Controller
|
|||
}
|
||||
$this->userRepo->destroy($user);
|
||||
|
||||
return redirect('/users');
|
||||
return redirect('/settings/users');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the user profile page
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function showProfilePage($id)
|
||||
{
|
||||
$user = $this->userRepo->getById($id);
|
||||
$userActivity = $this->userRepo->getActivity($user);
|
||||
$recentPages = $this->userRepo->getCreatedPages($user, 5, 0);
|
||||
return view('users/profile', ['user' => $user, 'activity' => $userActivity, 'recentPages' => $recentPages]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,14 +47,8 @@ Route::group(['middleware' => 'auth'], function () {
|
|||
|
||||
});
|
||||
|
||||
// Users
|
||||
Route::get('/users', 'UserController@index');
|
||||
Route::get('/users/create', 'UserController@create');
|
||||
Route::get('/users/{id}/delete', 'UserController@delete');
|
||||
Route::post('/users/create', 'UserController@store');
|
||||
Route::get('/users/{id}', 'UserController@edit');
|
||||
Route::put('/users/{id}', 'UserController@update');
|
||||
Route::delete('/users/{id}', 'UserController@destroy');
|
||||
// User Profile routes
|
||||
Route::get('/user/{userId}', 'UserController@showProfilePage');
|
||||
|
||||
// Image routes
|
||||
Route::group(['prefix' => 'images'], function() {
|
||||
|
@ -82,8 +76,18 @@ Route::group(['middleware' => 'auth'], function () {
|
|||
Route::get('/home', 'HomeController@index');
|
||||
|
||||
// Settings
|
||||
Route::get('/settings', 'SettingController@index');
|
||||
Route::post('/settings', 'SettingController@update');
|
||||
Route::group(['prefix' => 'settings'], function() {
|
||||
Route::get('/', 'SettingController@index');
|
||||
Route::post('/', 'SettingController@update');
|
||||
// Users
|
||||
Route::get('/users', 'UserController@index');
|
||||
Route::get('/users/create', 'UserController@create');
|
||||
Route::get('/users/{id}/delete', 'UserController@delete');
|
||||
Route::post('/users/create', 'UserController@store');
|
||||
Route::get('/users/{id}', 'UserController@edit');
|
||||
Route::put('/users/{id}', 'UserController@update');
|
||||
Route::delete('/users/{id}', 'UserController@destroy');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php namespace BookStack\Repos;
|
||||
|
||||
|
||||
use BookStack\Page;
|
||||
use BookStack\Role;
|
||||
use BookStack\Services\EntityService;
|
||||
use BookStack\User;
|
||||
use Setting;
|
||||
|
||||
|
@ -10,15 +12,19 @@ class UserRepo
|
|||
|
||||
protected $user;
|
||||
protected $role;
|
||||
protected $entityService;
|
||||
|
||||
/**
|
||||
* UserRepo constructor.
|
||||
* @param $user
|
||||
* @param User $user
|
||||
* @param Role $role
|
||||
* @param EntityService $entityService
|
||||
*/
|
||||
public function __construct(User $user, Role $role)
|
||||
public function __construct(User $user, Role $role, EntityService $entityService)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->role = $role;
|
||||
$this->entityService = $entityService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,4 +118,42 @@ class UserRepo
|
|||
$user->socialAccounts()->delete();
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest activity for a user.
|
||||
* @param User $user
|
||||
* @param int $count
|
||||
* @param int $page
|
||||
* @return array
|
||||
*/
|
||||
public function getActivity(User $user, $count = 20, $page = 0)
|
||||
{
|
||||
return \Activity::userActivity($user, $count, $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pages the the given user has created.
|
||||
* @param User $user
|
||||
* @param int $count
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCreatedPages(User $user, $count = 20, $page = 0)
|
||||
{
|
||||
return $this->entityService->page->where('created_by', '=', $user->id)->orderBy('created_at', 'desc')
|
||||
->skip($page * $count)->take($count)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get asset created counts for the give user.
|
||||
* @return array
|
||||
*/
|
||||
public function getAssetCounts(User $user)
|
||||
{
|
||||
return [
|
||||
'pages' => $this->entityService->page->where('created_by', '=', $user->id)->count(),
|
||||
'chapters' => $this->entityService->chapter->where('created_by', '=', $user->id)->count(),
|
||||
'books' => $this->entityService->book->where('created_by', '=', $user->id)->count(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -91,14 +91,14 @@ class ActivityService
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the latest activity for an entitiy, Filtering out similar
|
||||
* Gets the latest activity for an entity, Filtering out similar
|
||||
* items to prevent a message activity list.
|
||||
* @param Entity $entity
|
||||
* @param int $count
|
||||
* @param int $page
|
||||
* @return array
|
||||
*/
|
||||
function entityActivity($entity, $count = 20, $page = 0)
|
||||
public function entityActivity($entity, $count = 20, $page = 0)
|
||||
{
|
||||
$activity = $entity->hasMany('BookStack\Activity')->orderBy('created_at', 'desc')
|
||||
->skip($count * $page)->take($count)->get();
|
||||
|
@ -107,15 +107,30 @@ class ActivityService
|
|||
}
|
||||
|
||||
/**
|
||||
* Filters out similar activity.
|
||||
* @param Activity[] $activity
|
||||
* Get latest activity for a user, Filtering out similar
|
||||
* items.
|
||||
* @param $user
|
||||
* @param int $count
|
||||
* @param int $page
|
||||
* @return array
|
||||
*/
|
||||
protected function filterSimilar($activity)
|
||||
public function userActivity($user, $count = 20, $page = 0)
|
||||
{
|
||||
$activity = $this->activity->where('user_id', '=', $user->id)
|
||||
->orderBy('created_at', 'desc')->skip($count * $page)->take($count)->get();
|
||||
return $this->filterSimilar($activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out similar activity.
|
||||
* @param Activity[] $activities
|
||||
* @return array
|
||||
*/
|
||||
protected function filterSimilar($activities)
|
||||
{
|
||||
$newActivity = [];
|
||||
$previousItem = false;
|
||||
foreach ($activity as $activityItem) {
|
||||
foreach ($activities as $activityItem) {
|
||||
if ($previousItem === false) {
|
||||
$previousItem = $activityItem;
|
||||
$newActivity[] = $activityItem;
|
||||
|
|
29
app/Services/EntityService.php
Normal file
29
app/Services/EntityService.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php namespace BookStack\Services;
|
||||
|
||||
|
||||
use BookStack\Book;
|
||||
use BookStack\Chapter;
|
||||
use BookStack\Page;
|
||||
|
||||
class EntityService
|
||||
{
|
||||
|
||||
public $book;
|
||||
public $chapter;
|
||||
public $page;
|
||||
|
||||
/**
|
||||
* EntityService constructor.
|
||||
* @param $book
|
||||
* @param $chapter
|
||||
* @param $page
|
||||
*/
|
||||
public function __construct(Book $book, Chapter $chapter, Page $page)
|
||||
{
|
||||
$this->book = $book;
|
||||
$this->chapter = $chapter;
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -164,6 +164,6 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
*/
|
||||
public function getEditUrl()
|
||||
{
|
||||
return '/users/' . $this->id;
|
||||
return '/settings/users/' . $this->id;
|
||||
}
|
||||
}
|
||||
|
|
189
composer.lock
generated
189
composer.lock
generated
|
@ -9,16 +9,16 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.14.2",
|
||||
"version": "3.15.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "2970cb63e7b7b37dd8c07a4fa4e4e18a110ed4e2"
|
||||
"reference": "5e6078913293576de969703481994b77c380ca30"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2970cb63e7b7b37dd8c07a4fa4e4e18a110ed4e2",
|
||||
"reference": "2970cb63e7b7b37dd8c07a4fa4e4e18a110ed4e2",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5e6078913293576de969703481994b77c380ca30",
|
||||
"reference": "5e6078913293576de969703481994b77c380ca30",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -40,7 +40,8 @@
|
|||
"ext-simplexml": "*",
|
||||
"ext-spl": "*",
|
||||
"nette/neon": "^2.3",
|
||||
"phpunit/phpunit": "~4.0|~5.0"
|
||||
"phpunit/phpunit": "~4.0|~5.0",
|
||||
"psr/cache": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
|
||||
|
@ -84,7 +85,7 @@
|
|||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2016-01-28 21:33:18"
|
||||
"time": "2016-02-11 23:23:31"
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/laravel-debugbar",
|
||||
|
@ -918,16 +919,16 @@
|
|||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.2.12",
|
||||
"version": "v5.2.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "6b6255ad7bfbdb721b8d00b09d52b146c5d363d7"
|
||||
"reference": "39e89553c124dce266da03ee3c0260bdd62f1848"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/6b6255ad7bfbdb721b8d00b09d52b146c5d363d7",
|
||||
"reference": "6b6255ad7bfbdb721b8d00b09d52b146c5d363d7",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/39e89553c124dce266da03ee3c0260bdd62f1848",
|
||||
"reference": "39e89553c124dce266da03ee3c0260bdd62f1848",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1042,7 +1043,7 @@
|
|||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2016-01-26 04:15:37"
|
||||
"time": "2016-02-15 17:46:58"
|
||||
},
|
||||
{
|
||||
"name": "laravel/socialite",
|
||||
|
@ -1629,16 +1630,16 @@
|
|||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "1.1.6",
|
||||
"version": "v1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "e6f80ab77885151908d0ec743689ca700886e8b0"
|
||||
"reference": "b0e69d10852716b2ccbdff69c75c477637220790"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/e6f80ab77885151908d0ec743689ca700886e8b0",
|
||||
"reference": "e6f80ab77885151908d0ec743689ca700886e8b0",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/b0e69d10852716b2ccbdff69c75c477637220790",
|
||||
"reference": "b0e69d10852716b2ccbdff69c75c477637220790",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1673,7 +1674,7 @@
|
|||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2016-01-29 16:19:52"
|
||||
"time": "2016-02-06 03:52:05"
|
||||
},
|
||||
{
|
||||
"name": "phenx/php-font-lib",
|
||||
|
@ -2024,16 +2025,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3"
|
||||
"reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
|
||||
"reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
|
||||
"reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2080,20 +2081,20 @@
|
|||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-22 10:39:06"
|
||||
"time": "2016-02-02 13:44:19"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "73612266ac709769effdbfc0762e5b07cfd2ac2a"
|
||||
"reference": "29606049ced1ec715475f88d1bbe587252a3476e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/73612266ac709769effdbfc0762e5b07cfd2ac2a",
|
||||
"reference": "73612266ac709769effdbfc0762e5b07cfd2ac2a",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/29606049ced1ec715475f88d1bbe587252a3476e",
|
||||
"reference": "29606049ced1ec715475f88d1bbe587252a3476e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2137,20 +2138,20 @@
|
|||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-26 13:39:53"
|
||||
"time": "2016-01-27 05:14:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "d36355e026905fa5229e1ed7b4e9eda2e67adfcf"
|
||||
"reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d36355e026905fa5229e1ed7b4e9eda2e67adfcf",
|
||||
"reference": "d36355e026905fa5229e1ed7b4e9eda2e67adfcf",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
|
||||
"reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2197,20 +2198,20 @@
|
|||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-10-30 23:35:59"
|
||||
"time": "2016-01-27 05:14:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "8617895eb798b6bdb338321ce19453dc113e5675"
|
||||
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/8617895eb798b6bdb338321ce19453dc113e5675",
|
||||
"reference": "8617895eb798b6bdb338321ce19453dc113e5675",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723",
|
||||
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2246,20 +2247,20 @@
|
|||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-05 11:13:14"
|
||||
"time": "2016-01-27 05:14:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "939c8c28a5b1e4ab7317bc30c1f9aa881c4b06b5"
|
||||
"reference": "9344a87ceedfc50354a39653e54257ee9aa6a77d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/939c8c28a5b1e4ab7317bc30c1f9aa881c4b06b5",
|
||||
"reference": "939c8c28a5b1e4ab7317bc30c1f9aa881c4b06b5",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/9344a87ceedfc50354a39653e54257ee9aa6a77d",
|
||||
"reference": "9344a87ceedfc50354a39653e54257ee9aa6a77d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2298,20 +2299,20 @@
|
|||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-18 15:43:53"
|
||||
"time": "2016-02-02 13:44:19"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "f7933e9f19e26e7baba7ec04735b466fedd3a6db"
|
||||
"reference": "cec02604450481ac26710ca4249cc61b57b23942"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/f7933e9f19e26e7baba7ec04735b466fedd3a6db",
|
||||
"reference": "f7933e9f19e26e7baba7ec04735b466fedd3a6db",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/cec02604450481ac26710ca4249cc61b57b23942",
|
||||
"reference": "cec02604450481ac26710ca4249cc61b57b23942",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2380,7 +2381,7 @@
|
|||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-26 16:46:13"
|
||||
"time": "2016-02-03 12:38:44"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
|
@ -2551,16 +2552,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3"
|
||||
"reference": "dfecef47506179db2501430e732adbf3793099c8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
|
||||
"reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/dfecef47506179db2501430e732adbf3793099c8",
|
||||
"reference": "dfecef47506179db2501430e732adbf3793099c8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2596,20 +2597,20 @@
|
|||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-23 11:04:02"
|
||||
"time": "2016-02-02 13:44:19"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
"reference": "3b1bac52f42cb0f54df1a2dbabd55a1d214e2a59"
|
||||
"reference": "4686baa55a835e1c1ede9b86ba02415c8c8d6166"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/3b1bac52f42cb0f54df1a2dbabd55a1d214e2a59",
|
||||
"reference": "3b1bac52f42cb0f54df1a2dbabd55a1d214e2a59",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/4686baa55a835e1c1ede9b86ba02415c8c8d6166",
|
||||
"reference": "4686baa55a835e1c1ede9b86ba02415c8c8d6166",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2670,20 +2671,20 @@
|
|||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2015-12-23 08:00:11"
|
||||
"time": "2016-01-27 05:14:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "dff0867826a7068d673801b7522f8e2634016ef9"
|
||||
"reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/dff0867826a7068d673801b7522f8e2634016ef9",
|
||||
"reference": "dff0867826a7068d673801b7522f8e2634016ef9",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91",
|
||||
"reference": "2de0b6f7ebe43cffd8a06996ebec6aab79ea9e91",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2734,20 +2735,20 @@
|
|||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-05 17:45:07"
|
||||
"time": "2016-02-02 13:44:19"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "87db8700deb12ba2b65e858f656a1f885530bcb0"
|
||||
"reference": "24bb94807eff00db49374c37ebf56a0304e8aef3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/87db8700deb12ba2b65e858f656a1f885530bcb0",
|
||||
"reference": "87db8700deb12ba2b65e858f656a1f885530bcb0",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/24bb94807eff00db49374c37ebf56a0304e8aef3",
|
||||
"reference": "24bb94807eff00db49374c37ebf56a0304e8aef3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2797,7 +2798,7 @@
|
|||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2015-12-05 11:13:14"
|
||||
"time": "2016-01-07 13:38:51"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
|
@ -3182,22 +3183,24 @@
|
|||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "v1.5.0",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
|
||||
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
||||
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972",
|
||||
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "^1.0.2",
|
||||
"php": "^5.3|^7.0",
|
||||
"phpdocumentor/reflection-docblock": "~2.0",
|
||||
"sebastian/comparator": "~1.1"
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "~2.0"
|
||||
|
@ -3205,7 +3208,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
"dev-master": "1.5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -3238,7 +3241,7 @@
|
|||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2015-08-13 10:07:40"
|
||||
"time": "2016-02-15 07:46:21"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
@ -3482,16 +3485,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "4.8.21",
|
||||
"version": "4.8.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "ea76b17bced0500a28098626b84eda12dbcf119c"
|
||||
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c",
|
||||
"reference": "ea76b17bced0500a28098626b84eda12dbcf119c",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e351261f9cd33daf205a131a1ba61c6d33bd483",
|
||||
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3550,7 +3553,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-12-12 07:45:58"
|
||||
"time": "2016-02-11 14:56:33"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
|
@ -3981,16 +3984,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "4613311fd46e146f506403ce2f8a0c71d402d2a3"
|
||||
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/4613311fd46e146f506403ce2f8a0c71d402d2a3",
|
||||
"reference": "4613311fd46e146f506403ce2f8a0c71d402d2a3",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/6605602690578496091ac20ec7a5cbd160d4dff4",
|
||||
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -4030,20 +4033,20 @@
|
|||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-05 17:45:07"
|
||||
"time": "2016-01-27 05:14:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d"
|
||||
"reference": "b693a9650aa004576b593ff2e91ae749dc90123d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d",
|
||||
"reference": "7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b693a9650aa004576b593ff2e91ae749dc90123d",
|
||||
"reference": "b693a9650aa004576b593ff2e91ae749dc90123d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -4086,20 +4089,20 @@
|
|||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-26 13:42:31"
|
||||
"time": "2016-01-25 09:56:57"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
|
||||
"reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
|
||||
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/3cf0709d7fe936e97bee9e954382e449003f1d9a",
|
||||
"reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -4135,7 +4138,7 @@
|
|||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-12-26 13:39:53"
|
||||
"time": "2016-02-02 13:44:19"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
|
@ -18,7 +18,7 @@ class CreateUsersTable extends Migration
|
|||
$table->string('email')->unique();
|
||||
$table->string('password', 60);
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
|
||||
\BookStack\User::forceCreate([
|
||||
|
|
|
@ -17,7 +17,7 @@ class CreateBooksTable extends Migration
|
|||
$table->string('name');
|
||||
$table->string('slug')->indexed();
|
||||
$table->text('description');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class CreatePagesTable extends Migration
|
|||
$table->longText('html');
|
||||
$table->longText('text');
|
||||
$table->integer('priority');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class CreateImagesTable extends Migration
|
|||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('url');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class CreateChaptersTable extends Migration
|
|||
$table->text('name');
|
||||
$table->text('description');
|
||||
$table->integer('priority');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class CreatePageRevisionsTable extends Migration
|
|||
$table->longText('html');
|
||||
$table->longText('text');
|
||||
$table->integer('created_by');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class CreateActivitiesTable extends Migration
|
|||
$table->integer('user_id');
|
||||
$table->integer('entity_id');
|
||||
$table->string('entity_type');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class AddRolesAndPermissions extends Migration
|
|||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
|
||||
// Create table for associating roles to users (Many-to-Many)
|
||||
|
@ -50,7 +50,7 @@ class AddRolesAndPermissions extends Migration
|
|||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
|
||||
// Create table for associating permissions to roles (Many-to-Many)
|
||||
|
|
|
@ -15,7 +15,7 @@ class CreateSettingsTable extends Migration
|
|||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->string('setting_key')->primary()->indexed();
|
||||
$table->text('value');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class CreateSocialAccountsTable extends Migration
|
|||
$table->string('driver')->index();
|
||||
$table->string('driver_id');
|
||||
$table->string('avatar');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class AddEmailConfirmationTable extends Migration
|
|||
$table->increments('id');
|
||||
$table->integer('user_id')->index();
|
||||
$table->string('token')->index();
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class CreateViewsTable extends Migration
|
|||
$table->integer('viewable_id');
|
||||
$table->string('viewable_type');
|
||||
$table->integer('views');
|
||||
$table->timestamps();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</span>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-lg"></i>Edit Profile</a>
|
||||
<a href="/settings/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-lg"></i>Edit Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-lg"></i>Logout</a>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12 setting-nav">
|
||||
<a href="/settings" @if($selected == 'settings') class="selected text-button" @endif><i class="zmdi zmdi-settings"></i>Settings</a>
|
||||
<a href="/users" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
|
||||
<a href="/settings/users" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="container small" ng-non-bindable>
|
||||
<h1>Create User</h1>
|
||||
|
||||
<form action="/users/create" method="post">
|
||||
<form action="/settings/users/create" method="post">
|
||||
{!! csrf_field() !!}
|
||||
@include('users.forms.' . $authMethod)
|
||||
</form>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<p>This will fully delete this user with the name '<span class="text-neg">{{$user->name}}</span>' from the system.</p>
|
||||
<p class="text-neg">Are you sure you want to delete this user?</p>
|
||||
|
||||
<form action="/users/{{$user->id}}" method="POST">
|
||||
<form action="/settings/users/{{$user->id}}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<a href="/users/{{$user->id}}" class="button muted">Cancel</a>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="col-sm-6"></div>
|
||||
<div class="col-sm-6 faded">
|
||||
<div class="action-buttons">
|
||||
<a href="/users/{{$user->id}}/delete" class="text-neg text-button"><i class="zmdi zmdi-delete"></i>Delete User</a>
|
||||
<a href="/settings/users/{{$user->id}}/delete" class="text-neg text-button"><i class="zmdi zmdi-delete"></i>Delete User</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
<div class="container small">
|
||||
<form action="/users/{{$user->id}}" method="post">
|
||||
<form action="/settings/users/{{$user->id}}" method="post">
|
||||
<div class="row">
|
||||
<div class="col-md-6" ng-non-bindable>
|
||||
<h1>Edit {{ $user->id === $currentUser->id ? 'Profile' : 'User' }}</h1>
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<a href="/users" class="button muted">Cancel</a>
|
||||
<a href="/settings/users" class="button muted">Cancel</a>
|
||||
<button class="button pos" type="submit">Save</button>
|
||||
</div>
|
|
@ -34,7 +34,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<a href="/users" class="button muted">Cancel</a>
|
||||
<a href="/settings/users" class="button muted">Cancel</a>
|
||||
<button class="button pos" type="submit">Save</button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<h1>Users</h1>
|
||||
@if($currentUser->can('user-create'))
|
||||
<p>
|
||||
<a href="/users/create" class="text-pos"><i class="zmdi zmdi-account-add"></i>Add new user</a>
|
||||
<a href="/settings/users/create" class="text-pos"><i class="zmdi zmdi-account-add"></i>Add new user</a>
|
||||
</p>
|
||||
@endif
|
||||
<table class="table">
|
||||
|
@ -25,7 +25,7 @@
|
|||
<td style="line-height: 0;"><img class="avatar med" src="{{$user->getAvatar(40)}}" alt="{{$user->name}}"></td>
|
||||
<td>
|
||||
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
|
||||
<a href="/users/{{$user->id}}">
|
||||
<a href="/settings/users/{{$user->id}}">
|
||||
@endif
|
||||
{{ $user->name }}
|
||||
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
|
||||
|
@ -34,7 +34,7 @@
|
|||
</td>
|
||||
<td>
|
||||
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
|
||||
<a href="/users/{{$user->id}}">
|
||||
<a href="/settings/users/{{$user->id}}">
|
||||
@endif
|
||||
{{ $user->email }}
|
||||
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
|
||||
|
|
27
resources/views/users/profile.blade.php
Normal file
27
resources/views/users/profile.blade.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container" ng-non-bindable>
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
|
||||
<div class="padded-top large"></div>
|
||||
<img class="" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}">
|
||||
<h3>{{ $user->name }}</h3>
|
||||
<p class="text-muted">
|
||||
User for {{ $user->created_at->diffForHumans(null, true) }}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<h3>Recent Activity</h3>
|
||||
@include('partials/activity-list', ['activity' => $activity])
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
|
@ -129,7 +129,7 @@ class AuthTest extends TestCase
|
|||
$user = factory(\BookStack\User::class)->make();
|
||||
|
||||
$this->asAdmin()
|
||||
->visit('/users')
|
||||
->visit('/settings/users')
|
||||
->click('Add new user')
|
||||
->type($user->name, '#name')
|
||||
->type($user->email, '#email')
|
||||
|
@ -138,7 +138,7 @@ class AuthTest extends TestCase
|
|||
->type($user->password, '#password-confirm')
|
||||
->press('Save')
|
||||
->seeInDatabase('users', $user->toArray())
|
||||
->seePageIs('/users')
|
||||
->seePageIs('/settings/users')
|
||||
->see($user->name);
|
||||
}
|
||||
|
||||
|
@ -147,13 +147,13 @@ class AuthTest extends TestCase
|
|||
$user = \BookStack\User::all()->last();
|
||||
$password = $user->password;
|
||||
$this->asAdmin()
|
||||
->visit('/users')
|
||||
->visit('/settings/users')
|
||||
->click($user->name)
|
||||
->seePageIs('/users/' . $user->id)
|
||||
->seePageIs('/settings/users/' . $user->id)
|
||||
->see($user->email)
|
||||
->type('Barry Scott', '#name')
|
||||
->press('Save')
|
||||
->seePageIs('/users')
|
||||
->seePageIs('/settings/users')
|
||||
->seeInDatabase('users', ['id' => $user->id, 'name' => 'Barry Scott', 'password' => $password])
|
||||
->notSeeInDatabase('users', ['name' => $user->name]);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class AuthTest extends TestCase
|
|||
public function test_user_password_update()
|
||||
{
|
||||
$user = \BookStack\User::all()->last();
|
||||
$userProfilePage = '/users/' . $user->id;
|
||||
$userProfilePage = '/settings/users/' . $user->id;
|
||||
$this->asAdmin()
|
||||
->visit($userProfilePage)
|
||||
->type('newpassword', '#password')
|
||||
|
@ -172,7 +172,7 @@ class AuthTest extends TestCase
|
|||
->type('newpassword', '#password')
|
||||
->type('newpassword', '#password-confirm')
|
||||
->press('Save')
|
||||
->seePageIs('/users');
|
||||
->seePageIs('/settings/users');
|
||||
|
||||
$userPassword = \BookStack\User::find($user->id)->password;
|
||||
$this->assertTrue(Hash::check('newpassword', $userPassword));
|
||||
|
@ -184,11 +184,11 @@ class AuthTest extends TestCase
|
|||
$user = $this->getNewUser($userDetails->toArray());
|
||||
|
||||
$this->asAdmin()
|
||||
->visit('/users/' . $user->id)
|
||||
->visit('/settings/users/' . $user->id)
|
||||
->click('Delete User')
|
||||
->see($user->name)
|
||||
->press('Confirm')
|
||||
->seePageIs('/users')
|
||||
->seePageIs('/settings/users')
|
||||
->notSeeInDatabase('users', ['name' => $user->name]);
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,10 @@ class AuthTest extends TestCase
|
|||
$this->assertEquals(1, $adminRole->users()->count());
|
||||
$user = $adminRole->users->first();
|
||||
|
||||
$this->asAdmin()->visit('/users/' . $user->id)
|
||||
$this->asAdmin()->visit('/settings/users/' . $user->id)
|
||||
->click('Delete User')
|
||||
->press('Confirm')
|
||||
->seePageIs('/users/' . $user->id)
|
||||
->seePageIs('/settings/users/' . $user->id)
|
||||
->see('You cannot delete the only admin');
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class LdapTest extends \TestCase
|
|||
|
||||
public function test_create_user_form()
|
||||
{
|
||||
$this->asAdmin()->visit('/users/create')
|
||||
$this->asAdmin()->visit('/settings/users/create')
|
||||
->dontSee('Password')
|
||||
->type($this->mockUser->name, '#name')
|
||||
->type($this->mockUser->email, '#email')
|
||||
|
@ -102,19 +102,19 @@ class LdapTest extends \TestCase
|
|||
->see('The external auth id field is required.')
|
||||
->type($this->mockUser->name, '#external_auth_id')
|
||||
->press('Save')
|
||||
->seePageIs('/users')
|
||||
->seePageIs('/settings/users')
|
||||
->seeInDatabase('users', ['email' => $this->mockUser->email, 'external_auth_id' => $this->mockUser->name, 'email_confirmed' => true]);
|
||||
}
|
||||
|
||||
public function test_user_edit_form()
|
||||
{
|
||||
$editUser = User::all()->last();
|
||||
$this->asAdmin()->visit('/users/' . $editUser->id)
|
||||
$this->asAdmin()->visit('/settings/users/' . $editUser->id)
|
||||
->see('Edit User')
|
||||
->dontSee('Password')
|
||||
->type('test_auth_id', '#external_auth_id')
|
||||
->press('Save')
|
||||
->seePageIs('/users')
|
||||
->seePageIs('/settings/users')
|
||||
->seeInDatabase('users', ['email' => $editUser->email, 'external_auth_id' => 'test_auth_id']);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class LdapTest extends \TestCase
|
|||
public function test_non_admins_cannot_change_auth_id()
|
||||
{
|
||||
$testUser = User::all()->last();
|
||||
$this->actingAs($testUser)->visit('/users/' . $testUser->id)
|
||||
$this->actingAs($testUser)->visit('/settings/users/' . $testUser->id)
|
||||
->dontSee('External Authentication');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user