Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/server/assets/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h6 class="dropdown-header">Manage realm</h6>
<a class="dropdown-item {{if .currentPath.IsDir "/realm/events"}}active{{end}}" href="/realm/events">Event log</a>
<a class="dropdown-item {{if .currentPath.IsDir "/realm/keys"}}active{{end}}" href="/realm/keys">Signing keys</a>
<a class="dropdown-item {{if .currentPath.IsDir "/realm/stats"}}active{{end}}" href="/realm/stats">Statistics</a>
<a class="dropdown-item {{if .currentPath.IsDir "/users"}}active{{end}}" href="/users">Users</a>
<a class="dropdown-item {{if .currentPath.IsDir "/realm/users"}}active{{end}}" href="/realm/users">Users</a>
<a class="dropdown-item {{if .currentPath.IsDir "/realm/settings"}}active{{end}}" href="/realm/settings#general">Settings</a>
<div class="dropdown-divider"></div>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/assets/login/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h6 class="card-title mt-3">System admin</h6>

{{- /* system admins can remove themselves from realms */ -}}
{{if $user.SystemAdmin}}
<a href="/users/{{.ID}}" class="d-block text-danger float-right" data-method="DELETE"
<a href="/realm/users/{{.ID}}" class="d-block text-danger float-right" data-method="DELETE"
data-confirm="Are you sure you want to leave {{.Name}}?">
<span class="oi oi-account-logout" aria-hidden="true"></span>
Leave realm
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/assets/users/_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
{{$user := .user}}

{{if $user.ID}}
<form method="POST" action="/users/{{$user.ID}}">
<form method="POST" action="/realm/users/{{$user.ID}}">
<input type="hidden" name="_method" value="PATCH">
{{else}}
<form method="POST" action="/users">
<form method="POST" action="/realm/users">
{{end}}

{{ .csrfField }}
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/assets/users/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h1>Import users</h1>
</table>
</div>
</div>
<a class=" card-link" href="/users">&larr; All users</a>
<a class=" card-link" href="/realm/users">&larr; All users</a>
</main>

<script type="text/javascript">
Expand Down Expand Up @@ -177,7 +177,7 @@ <h1>Import users</h1>
function uploadBatch(data) {
return $.ajax({
type: 'POST',
url: '/users/import',
url: '/realm/users/import',
data: JSON.stringify({ "users": data }),
headers: { 'X-CSRF-Token': '{{.csrfToken}}' },
contentType: 'application/json',
Expand Down
10 changes: 5 additions & 5 deletions cmd/server/assets/users/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
<div class="card-header">
<span class="oi oi-person mr-2 ml-n1" aria-hidden="true"></span>
Users
<a href="/users/new" class="float-right mr-n1 text-secondary" data-toggle="tooltip" title="New user">
<a href="/realm/users/new" class="float-right mr-n1 text-secondary" data-toggle="tooltip" title="New user">
<span class="oi oi-plus small" aria-hidden="true"></span>
</a>
<a href="/users/import" class="float-right mr-3 text-secondary" data-toggle="tooltip" title="Bulk import users">
<a href="/realm/users/import" class="float-right mr-3 text-secondary" data-toggle="tooltip" title="Bulk import users">
<span class="oi oi-data-transfer-upload" aria-hidden="true"></span>
</a>
</div>

<div class="card-body">
<form method="GET" action="/users" id="search-form">
<form method="GET" action="/realm/users" id="search-form">
<div class="input-group">
<span class="input-group-prepend">
<div class="input-group-text bg-transparent">
Expand All @@ -57,7 +57,7 @@
{{range $users}}
<tr id="user-{{.ID}}">
<td>
<a href="/users/{{.ID}}">{{.Name}}</a>
<a href="/realm/users/{{.ID}}">{{.Name}}</a>
{{if .CanAdminRealm $currentRealm.ID}}
<span class="ml-1 badge badge-pill badge-primary">Admin</span>
{{end}}
Expand All @@ -68,7 +68,7 @@
<td class="text-center">
{{if not (eq .ID $currentUser.ID)}}
{{- /* cannot delete yourself */ -}}
<a href="/users/{{.ID}}" class="d-block text-danger" data-method="DELETE"
<a href="/realm/users/{{.ID}}" class="d-block text-danger" data-method="DELETE"
data-confirm="Are you sure you want to remove '{{.Name}}'?" data-toggle="tooltip"
title="Remove this user">
<span class="oi oi-trash" aria-hidden="true"></span>
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/assets/users/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>New user</h1>
{{template "users/_form" .}}
</div>
</div>
<a class="card-link" href="/users" id="all-users">&larr; All users</a>
<a class="card-link" href="/realm/users" id="all-users">&larr; All users</a>
</main>
</body>

Expand Down
6 changes: 3 additions & 3 deletions cmd/server/assets/users/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<h1>{{$user.Name}}</h1>
<p class="float-right">
<a href="/users/{{$user.ID}}/edit">Edit</a>
<a href="/realm/users/{{$user.ID}}/edit">Edit</a>
</p>
<p>
Here is information about the user.
Expand Down Expand Up @@ -46,7 +46,7 @@ <h6 class="card-title">Realm admin</h6>
{{end}}
</div>

<a href="/users/{{$user.ID}}/reset-password" data-method="POST" class="btn btn-primary btn-block">Send password reset</a>
<a href="/realm/users/{{$user.ID}}/reset-password" data-method="POST" class="btn btn-primary btn-block">Send password reset</a>
</div>
</div>

Expand Down Expand Up @@ -82,7 +82,7 @@ <h6 class="card-title">Realm admin</h6>
</div>
</div>

<a class="card-link" href="/users">&larr; All users</a>
<a class="card-link" href="/realm/users">&larr; All users</a>
</main>

{{if $stats}}
Expand Down
2 changes: 1 addition & 1 deletion internal/routes/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func Server(

// users
{
userSub := r.PathPrefix("/users").Subrouter()
userSub := r.PathPrefix("/realm/users").Subrouter()
userSub.Use(requireAuth)
userSub.Use(loadCurrentRealm)
userSub.Use(requireRealm)
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/user/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ func (c *Controller) HandleDelete() http.Handler {
// themselves from the system admin panel.
if user.ID == currentUser.ID {
flash.Error("Failed to remove user from realm: cannot remove self")
http.Redirect(w, r, "/users", http.StatusSeeOther)
http.Redirect(w, r, "/realm/users", http.StatusSeeOther)
return
}

user.RemoveRealm(realm)

if err := c.db.SaveUser(user, currentUser); err != nil {
flash.Error("Failed to remove user from realm: %v", err)
http.Redirect(w, r, "/users", http.StatusSeeOther)
http.Redirect(w, r, "/realm/users", http.StatusSeeOther)
return
}

Expand All @@ -83,6 +83,6 @@ func (c *Controller) HandleDelete() http.Handler {
}

flash.Alert("Successfully removed user %v from realm", user.Email)
http.Redirect(w, r, "/users", http.StatusSeeOther)
http.Redirect(w, r, "/realm/users", http.StatusSeeOther)
})
}
2 changes: 1 addition & 1 deletion pkg/controller/user/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestHandleSearch(t *testing.T) {
browser.SetCookie(cookie),

// Visit /apikeys/new.
chromedp.Navigate(`http://`+harness.Server.Addr()+`/users`),
chromedp.Navigate(`http://`+harness.Server.Addr()+`/realm/users`),

// Wait for render.
chromedp.WaitVisible(`body#users-index`, chromedp.ByQuery),
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/user/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (c *Controller) HandleUpdate() http.Handler {
}

flash.Alert("Successfully updated user '%v'", form.Name)
http.Redirect(w, r, "/users", http.StatusSeeOther)
http.Redirect(w, r, "/realm/users", http.StatusSeeOther)
})
}

Expand Down