This commit is contained in:
kiswa 2016-08-30 21:58:34 +00:00
parent 183a76414b
commit b994e030eb
6 changed files with 41 additions and 6 deletions

View File

@ -172,6 +172,10 @@ class Boards extends BaseController {
if (Auth::HasBoardAccess($this->container, if (Auth::HasBoardAccess($this->container,
$request, $board->id)) { $request, $board->id)) {
foreach($board->users as $user) {
$user = $this->cleanUser($user);
}
$boards[] = $board; $boards[] = $board;
} }
} }
@ -179,5 +183,13 @@ class Boards extends BaseController {
return $boards; return $boards;
} }
private function cleanUser($user) {
$user->security_level = $user->security_level->getValue();
unset($user->password_hash);
unset($user->active_token);
return $user;
}
} }

View File

@ -166,6 +166,18 @@ class Users extends BaseController {
} }
} }
if ($user->default_board_id !== $update->default_board_id &&
$update->default_board_id !== 0) {
$newId = $update->default_board_id;
if ($newId > 0 && !Auth::HasBoardAccess($this->container, $request,
$newId, $user->id)) {
$board = new Board($this->container, $update->default_board_id);
$board->users[] = $user;
$board->save();
}
}
$update->save(); $update->save();
$this->dbLogger->logChange($this->container, $actor->id, $this->dbLogger->logChange($this->container, $actor->id,
@ -263,9 +275,16 @@ class Users extends BaseController {
private function getAllUsersCleaned($request) { private function getAllUsersCleaned($request) {
$userBeans = R::findAll('user'); $userBeans = R::findAll('user');
$userId = Auth::GetUserId($request);
$userIds = $this->getUserIdsByBoardAccess(Auth::GetUserId($request)); $userIds = $this->getUserIdsByBoardAccess(Auth::GetUserId($request));
$actor = new User($this->container, Auth::GetUserId($request));
// If a user has no board access, they should still see themselves
if (count($userIds) === 0) {
$userIds[] = $userId;
}
$actor = new User($this->container, $userId);
$isAdmin = ($actor->security_level->getValue() === SecurityLevel::Admin); $isAdmin = ($actor->security_level->getValue() === SecurityLevel::Admin);
$data = []; $data = [];

View File

@ -31,7 +31,7 @@
Select default board: Select default board:
<select class="autosize" <select class="autosize"
[ngModel]="user.default_board_id" [ngModel]="user.default_board_id"
(ngModelChange)="updateDefaultBoard()"> (ngModelChange)="updateDefaultBoard($event)">
<option value="0">None</option> <option value="0">None</option>
<option *ngFor="let board of boards" value="{{ board.id }}"> <option *ngFor="let board of boards" value="{{ board.id }}">
{{ board.name }} {{ board.name }}

View File

@ -73,10 +73,13 @@ export class UserSettings implements OnInit {
}); });
} }
updateDefaultBoard() { updateDefaultBoard(boardId: string) {
this.user.default_board_id = parseInt(boardId);
this.users.changeDefaultBoard(this.user) this.users.changeDefaultBoard(this.user)
.subscribe((response: ApiResponse) => { .subscribe((response: ApiResponse) => {
this.addAlerts(response.alerts); this.addAlerts(response.alerts);
this.auth.updateUser(JSON.parse(response.data[1]));
}); });
} }

View File

@ -35,9 +35,10 @@
overflow-y: auto; overflow-y: auto;
position: fixed; position: fixed;
top: 50%; top: 50%;
transform: translateX(-50%) translateY(-50%) translateZ(0); transform: translate(-50%, -50%);
width: 400px; width: 400px;
z-index: 1100; z-index: 1100;
zoom: 1.01; // Fixes blurry text
&.animated { &.animated {
transition: all .3s; transition: all .3s;
@ -49,7 +50,7 @@
&.modal-closed { &.modal-closed {
opacity: 0; opacity: 0;
transform: translateX(-50%) translateY(-100%); transform: translate(-50%, -100%);
} }
.title { .title {

View File

@ -168,7 +168,7 @@
.inline-edit { .inline-edit {
display: inline-block; display: inline-block;
width: 82%; width: 80%;
.icon { .icon {
cursor: pointer; cursor: pointer;