如何解决如何共享具有特定用户 powershell Smbshare 完全访问权限的文件夹
如何与接收用户的 smbshare 共享文件夹 带 $ 的参数,在我的代码中文件夹的名称与 用户。我可以共享一个文件夹,对特定名称(如“管理员”)具有完全访问权限,但不能共享像 $username 这样的用户名。
import React,{useState,useEffect} from 'react';
import axios from 'axios';
import {Link} from 'react-router-dom';
import '../../static/Bookings.css';
import {BsFilterRight} from "react-icons/bs";
const Bookings= ()=>{
const[Bookings,setBooking]=useState([]);
const[searchByName,setSearchByName]=useState('');
const[FilteredNames,setFilteredNames]=useState([]);
const[searchByConsultant,setSearchByConsultant]=useState('');
const[FilteredConsultants,setFilteredConsultants]=useState([]);
useEffect(()=>{
loadUsers();
},[]);
useEffect(()=>{
setFilteredNames(
Bookings.filter(Booking=>{
return Booking.name.toLowerCase().includes(searchByName.toLowerCase())
})
)
},[searchByName,Bookings]);
useEffect(()=>{
setFilteredConsultants(
Bookings.filter(Booking=>{
return Booking.consultant.toLowerCase().includes(searchByConsultant.toLowerCase())
})
)
},[searchByConsultant,Bookings]);
const loadUsers= async()=>{
const result =await axios.get("http://localhost:3001/Bookings");
setBooking(result.data.reverse());
};
const deleteUser=async id => {
await axios.delete(`http://localhost:3001/Bookings/${id}`);
loadUsers();
}
return(
<div className="Booking-page-container">
<h2 className="text-center mb-4">Bookings Page</h2>
<table class="table table-bordered table-striped border shadow">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">
<BsFilterRight/>
<input
placeholder="search by name..."
onChange={e=>setSearchByName(e.target.value)}
/>
</th>
<th scope="col">
<BsFilterRight/>
<input
placeholder="search by consultant..."
onChange={e=>setSearchByConsultant(e.target.value)}
/>
</th>
<th scope="col">Email</th>
<th>Action</th>
</tr>
</thead>
<thead class="thead-dark">
<tr>
<th scope="col"></th>
<th scope="col">Name</th>
<th scope="col">Consultant</th>
<th scope="col">Email</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{FilteredNames.map((Booking,index)=>(
<tr>
<th scope="row">{index+1}</th>
<td>{Booking.name}</td>
<td>{Booking.consultant}</td>
<td>{Booking.email}</td>
<td>
<Link class="btn btn-primary mr-2" to={`/Bookings/view/${Booking.id}`}>View</Link>
<Link class="btn btn-outline-primary mr-2" to={`/Bookings/edit/${Booking.id}`}>Edit</Link>
<Link class="btn btn-danger" onClick={()=>deleteUser(Booking.id)}>Delete</Link>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
};
export default Bookings;
解决方法
不需要每个变量之间的引号,对于加入域的计算机,$username
应该采用 "DOMAIN\user"
格式,或者对于未加入域的计算机采用 "$env:ComputerName\user"
格式。如果共享已存在,您可以使用 Set-ACL
向新用户授予权限。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。