1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-10 09:20:26 +00:00
TiddlyWiki5/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid
webplusai e873518d6f
Admin configuration for anonymous read-write operations (#8736)
* mws authentication

* add more tests and permission checkers

* add logic to ensure that only authenticated users' requests are handled

* add custom login page

* Implement user authentication as well as session handling

* work on user operations authorization

* add middleware to route handlers for bags & tiddlers routes

* add feature that only returns the tiddlers and bags which the user has permission to access on index page

* refactor auth routes & added user management page

* fix Ci Test failure issue

* fix users list page, add manage roles page

* add commands and scripts to create new user & assign roles and permissions

* resolved ci-test failure

* add ACL permissions to bags & tiddlers on creation

* fix comments and access control list bug

* fix indentation issues

* working on user profile edit

* remove list users command & added support for database in server options

* implement user profile update and password change feature

* update plugin readme

* implement command which triggers protected mode on the server

* revert server-wide auth flag. Implement selective authorization

* ACL management feature

* Complete Access control list implementation

* Added support to manage users' assigned role by admin

* fix comments

* fix comment

* Add user profile management and account deletion functionality

* add success and error message feedback for user profile operations

* fix indentation issues

* Add command to create admin user if none exists when the start command is executed

* refactor annonymous user flow with create admin implementation

* remove mws-add-user from start command

* admin configuration for annonymous read-write opearations

* fix comments

* change get-anon handler to POST
2024-11-14 17:47:25 +00:00

129 lines
2.6 KiB
Plaintext

title: $:/plugins/tiddlywiki/multiwikiserver/templates/mws-header
<div class="mws-header">
<h1><$text text=<<page-title>>/></h1>
<div class="mws-user-info">
<span>Hello, <$text text=<<username>>/></span>
<% if [<user-is-admin>match[yes]] %>
<div class="mws-admin-dropdown">
<button class="mws-admin-dropbtn">⚙️</button>
<div class="mws-admin-dropdown-content">
<a href="/admin/users">Manage Users</a>
<a href="/admin/roles">Manage Roles</a>
<form action="/admin/anon" method="post" class="mws-admin-form">
<input type="submit" value="Reconfigure Anonymous Access" class="mws-admin-form-button"/>
</form>
</div>
</div>
<% elseif [<username>!match[Guest]]+[<first-guest-user>match[no]] %>
<a href={{{ [<user>jsonget[user_id]addprefix[/admin/users/]] }}}>
<button class="mws-profile-btn">Profile</button>
</a>
<% endif %>
<form action="/logout" method="post" class="mws-logout-form">
<input type="submit" value="Logout" class="mws-logout-button"/>
</form>
</div>
</div>
<style>
.mws-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
background-color: #f0f0f0;
margin-bottom: 20px;
}
.mws-user-info {
display: flex;
align-items: center;
}
.mws-logout-form {
margin-left: 10px;
}
.mws-logout-button {
padding: 5px 10px;
background-color: #f44336;
color: white;
border: none;
cursor: pointer;
}
.mws-logout-button:hover {
background-color: #d32f2f;
}
.mws-admin-dropdown {
position: relative;
display: inline-block;
margin-left: 10px;
}
.mws-admin-dropbtn {
color: white;
padding: 5px;
font-size: 16px;
border: none;
cursor: pointer;
}
.mws-admin-dropbtn:hover, .mws-admin-dropbtn:focus {
cursor: pointer;
opacity: 0.8;
}
.mws-admin-dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
right: 0;
}
.mws-admin-dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.mws-admin-dropdown-content a:hover {background-color: #ddd;}
.mws-admin-dropdown:hover .mws-admin-dropdown-content {display: block;}
.mws-admin-dropdown:hover {background-color: #2980B9;}
.mws-profile-btn {
background-color: #2980B9;
margin-left: 10px;
color: white;
border: none;
cursor: pointer;
padding: 5px 10px;
}
.mws-admin-form {
margin: 0;
}
.mws-admin-form-button {
width: 100%;
text-align: left;
padding: 12px 16px;
background: none;
border: none;
color: black;
cursor: pointer;
font-size: inherit;
}
.mws-admin-form-button:hover {
background-color: #ddd;
}
</style>