Commit 2aa70272 authored by Jason's avatar Jason

1.刪除鑰匙

2.user list 關閉the one disable和admin 被關閉功能
parent d0500e3e
...@@ -1225,15 +1225,27 @@ namespace backstage.Controllers ...@@ -1225,15 +1225,27 @@ namespace backstage.Controllers
public async Task<ResultModel> AdminAddAjax(int uid, int isAdmin) public async Task<ResultModel> AdminAddAjax(int uid, int isAdmin)
{ {
var result = new ResultModel(); var result = new ResultModel();
string msg;
if (uid == 1)
{
//// 確認使用者是否已經登入 switch (_currentLanguage)
//if (!User.Identity.IsAuthenticated) {
//{
// result.IsSuccess = false;
// result.Message = "未登入";
// return result;
//}
case "en":
msg = "This user can't be remove from admin permission.";
break;
case "zh":
msg = "此帳號不得移除Admin";
break;
default:
msg = "此帳號不得移除Admin";
break;
}
result.IsSuccess = false;
result.Message = msg;
return result;
}
// 取得使用者的 "token" Claim 值 // 取得使用者的 "token" Claim 值
string token = User.FindFirstValue("token"); string token = User.FindFirstValue("token");
...@@ -1377,7 +1389,27 @@ namespace backstage.Controllers ...@@ -1377,7 +1389,27 @@ namespace backstage.Controllers
// 取得使用者的 "token" Claim 值 // 取得使用者的 "token" Claim 值
string token = User.FindFirstValue("token"); string token = User.FindFirstValue("token");
string msg;
if (uid == 1)
{
switch (_currentLanguage)
{
case "en":
msg = "This user can't be disable.";
break;
case "zh":
msg = "此帳號不得disable";
break;
default:
msg = "此帳號不得disable";
break;
}
result.IsSuccess = false;
result.Message = msg;
return result;
}
#region user/list #region user/list
var url = _config["IP"] + "/user/list"; var url = _config["IP"] + "/user/list";
var httpMethod = HttpMethod.Post; var httpMethod = HttpMethod.Post;
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<a data-toggle="modal" data-target="#deleteProject" title="Delete"> <a data-toggle="modal" data-target="#deleteProject" title="Delete">
<a class="deleteKeyBtn" data-keyId="@k.id" data-toggle="modal" data-target="#deleteProject" title="Delete"> <a class="deleteKeyBtn" data-keyid="@k.id" data-toggle="modal" data-target="#deleteProject" title="Delete">
<i class="fa-solid fa-trash-can"></i> <i class="fa-solid fa-trash-can"></i>
</a> </a>
...@@ -285,7 +285,7 @@ ...@@ -285,7 +285,7 @@
</p> </p>
<div class="SubmitBlock SubmitBlock_sm"> <div class="SubmitBlock SubmitBlock_sm">
<button id="confirmBtn" type="submit" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px">@Localizer["Confirm"]</button> <button id="confirmBtn" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px">@Localizer["Confirm"]</button>
<button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px">@Localizer["Cancel"]</button> <button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px">@Localizer["Cancel"]</button>
</div> </div>
...@@ -323,6 +323,7 @@ ...@@ -323,6 +323,7 @@
var selectKeyId; var selectKeyId;
$('.deleteKeyBtn').click(function (e) { $('.deleteKeyBtn').click(function (e) {
selectKeyId = parseInt( $(this).data('keyid')); selectKeyId = parseInt( $(this).data('keyid'));
...@@ -332,7 +333,7 @@ ...@@ -332,7 +333,7 @@
//刪除鑰匙 //刪除鑰匙
$("#confirmBtn").on("click", function (e) { $("#confirmBtn").on("click", function (e) {
e.preventDefault(); // 防止點擊後刷新頁面(如果該鏈接是 <a> 標籤)
var data = { var data = {
keyId: selectKeyId keyId: selectKeyId
}; };
...@@ -346,8 +347,9 @@ ...@@ -346,8 +347,9 @@
// API 呼叫成功的處理程式碼 // API 呼叫成功的處理程式碼
showAlert(response.isSuccess, response.message) showAlert(response.isSuccess, response.message)
console.log(response);
if (response.isSuccess) { if (response.isSuccess) {
$('#deleteProject').modal('hide');
setTimeout(function () { setTimeout(function () {
location.reload(); location.reload();
}, 2000); }, 2000);
......
...@@ -70,9 +70,30 @@ ...@@ -70,9 +70,30 @@
@*<td>@i.locked</td>*@ @*<td>@i.locked</td>*@
<td>@i.creation_date</td> <td>@i.creation_date</td>
<td> <input type="checkbox" data-uid="@i.uid" class="toggleButton isEnable" @(i.enabled == 1 ? "checked" : "")></td> <td>
@if (i.uid == 1)
{
<input type="checkbox" data-uid="@i.uid" class="toggleButton isEnable" @(i.enabled == 1 ? "checked" : "") disabled>
}
else
{
<input type="checkbox" data-uid="@i.uid" class="toggleButton isEnable" @(i.enabled == 1 ? "checked" : "")>
}
</td>
<td>
@if (i.uid == 1)
{
<input type="checkbox" data-uid="@i.uid" class="toggleButton isAdmin" @(i.isAdmin ? "checked" : "") disabled>
}
else
{
<input type="checkbox" data-uid="@i.uid" class="toggleButton isAdmin" @(i.isAdmin ? "checked" : "")>
}
<td> <input type="checkbox" data-uid="@i.uid" class="toggleButton isAdmin" @(i.isAdmin ? "checked" : "")></td>
</td>
@*@if (i.isAdmin) @*@if (i.isAdmin)
{ <td>是</td>} { <td>是</td>}
else { <td></td>}*@ else { <td></td>}*@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment