|
@@ -1,3 +1,14 @@
|
|
|
+<script src="../../script/clipboard.min.js"></script>
|
|
|
+<style>
|
|
|
+ .smbaddr{
|
|
|
+ cursor:pointer;
|
|
|
+ color: #5c94cb;
|
|
|
+ }
|
|
|
+
|
|
|
+ .smbaddr:hover{
|
|
|
+ background-color: rgb(236, 236, 236) !important;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<div class="ui basic yellow message">
|
|
|
<h4 class="ui header">
|
|
|
<i class="yellow folder icon"></i>
|
|
@@ -10,8 +21,23 @@
|
|
|
</div>
|
|
|
<p>Click "Activate" to enable SMB access to your file system</p>
|
|
|
<button class="ui basic activateSmb button" onclick="activateAccountForThisUser();"><i class="ui green circle check icon"></i> Activate</button>
|
|
|
-<button class="ui basic disableSmb disabled button"><i class="ui red circle times icon"></i> Disable</button>
|
|
|
-
|
|
|
+<button class="ui basic disableSmb disabled button" onclick="disableAccountForThisUser();"><i class="ui red circle times icon"></i> Disable</button>
|
|
|
+<table class="ui very basic celled table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>Share Names</th>
|
|
|
+ <th>Path</th>
|
|
|
+ <th>Accessible By</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="userShareList">
|
|
|
+ <tr>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+</table>
|
|
|
<script>
|
|
|
function initSMBActivationStatusOnThisUser(){
|
|
|
$.get("/system/storage/samba/myshare", function(data){
|
|
@@ -26,18 +52,54 @@
|
|
|
$(".activateSmb").removeClass("disabled");
|
|
|
$(".disableSmb").addClass("disabled");
|
|
|
}
|
|
|
+
|
|
|
+ //Render the user share list
|
|
|
+ $("#userShareList").html(``);
|
|
|
+ data.UserSmbShareList.forEach(smbShare => {
|
|
|
+ $("#userShareList").append(`<tr>
|
|
|
+ <td>${smbShare.Name}</td>
|
|
|
+ <td class="smbaddr" data-clipboard-text="\\\\${window.location.hostname}\\${smbShare.Name}" ><small>\\\\${window.location.hostname}\\${smbShare.Name}</small></td>
|
|
|
+ <td>${smbShare.ValidUsers.join(", ")}</td>
|
|
|
+ </tr>`);
|
|
|
+ });
|
|
|
+ if (data.UserSmbShareList.length == 0){
|
|
|
+ $("#userShareList").append(`<tr><td colspan="3"><i class="ui green circle check icon"></i> This account has no shared folder</td></tr>`);
|
|
|
+ }else{
|
|
|
+ var clipboard = new ClipboardJS('.smbaddr');
|
|
|
+ clipboard.on('success', function(e) {
|
|
|
+ msgbox("Address copied. Paste to File Explorer to open share.")
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
initSMBActivationStatusOnThisUser();
|
|
|
|
|
|
+ function disableAccountForThisUser(){
|
|
|
+ $.get("/system/storage/samba/deactivate", function(data){
|
|
|
+ if (data.error != undefined){
|
|
|
+ msgbox(data.error, false, 6000);
|
|
|
+ }else{
|
|
|
+ if (data != false){
|
|
|
+ msgbox("SMB shares deactivated");
|
|
|
+ }
|
|
|
+ initSMBActivationStatusOnThisUser();
|
|
|
+
|
|
|
+ if (typeof(initShareListTable) != "undefined"){
|
|
|
+ initShareListTable();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//Activate account for user, require password confirmation
|
|
|
function activateAccountForThisUser(){
|
|
|
var apiObject = {
|
|
|
api: "../system/storage/samba/activate",
|
|
|
data: {},
|
|
|
title: `Activate SMB Access`,
|
|
|
- desc: `Confirm enable sharing my account using SMB (Samba)`,
|
|
|
+ desc: `Confirm sharing my account using SMB (Samba)`,
|
|
|
thisuser: true, //This username as default, set to false for entering other user
|
|
|
method: "POST",
|
|
|
success: undefined
|