mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-03 08:13:18 +02:00
FileSystemShare: Renamed event from OnAccessRequest to AccessRequested
This commit is contained in:
parent
fb7d6d4bc8
commit
b5db0ac4b8
2 changed files with 3 additions and 3 deletions
|
@ -37,7 +37,7 @@ namespace SMBLibrary.Server
|
||||||
private string m_name;
|
private string m_name;
|
||||||
private INTFileStore m_fileSystem;
|
private INTFileStore m_fileSystem;
|
||||||
|
|
||||||
public event EventHandler<AccessRequestArgs> OnAccessRequest;
|
public event EventHandler<AccessRequestArgs> AccessRequested;
|
||||||
|
|
||||||
public FileSystemShare(string shareName, INTFileStore fileSystem)
|
public FileSystemShare(string shareName, INTFileStore fileSystem)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ namespace SMBLibrary.Server
|
||||||
public bool HasAccess(SecurityContext securityContext, string path, FileAccess requestedAccess)
|
public bool HasAccess(SecurityContext securityContext, string path, FileAccess requestedAccess)
|
||||||
{
|
{
|
||||||
// To be thread-safe we must capture the delegate reference first
|
// To be thread-safe we must capture the delegate reference first
|
||||||
EventHandler<AccessRequestArgs> handler = OnAccessRequest;
|
EventHandler<AccessRequestArgs> handler = AccessRequested;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
AccessRequestArgs args = new AccessRequestArgs(securityContext.UserName, path, requestedAccess, securityContext.MachineName, securityContext.ClientEndPoint);
|
AccessRequestArgs args = new AccessRequestArgs(securityContext.UserName, path, requestedAccess, securityContext.MachineName, securityContext.ClientEndPoint);
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace SMBServer
|
||||||
XmlNode writeAccessNode = shareNode.SelectSingleNode("WriteAccess");
|
XmlNode writeAccessNode = shareNode.SelectSingleNode("WriteAccess");
|
||||||
List<string> writeAccess = ReadAccessList(writeAccessNode);
|
List<string> writeAccess = ReadAccessList(writeAccessNode);
|
||||||
FileSystemShare share = new FileSystemShare(shareName, new DirectoryFileSystem(sharePath));
|
FileSystemShare share = new FileSystemShare(shareName, new DirectoryFileSystem(sharePath));
|
||||||
share.OnAccessRequest += delegate(object sender, AccessRequestArgs args)
|
share.AccessRequested += delegate(object sender, AccessRequestArgs args)
|
||||||
{
|
{
|
||||||
bool hasReadAccess = Contains(readAccess, "Users") || Contains(readAccess, args.UserName);
|
bool hasReadAccess = Contains(readAccess, "Users") || Contains(readAccess, args.UserName);
|
||||||
bool hasWriteAccess = Contains(writeAccess, "Users") || Contains(writeAccess, args.UserName);
|
bool hasWriteAccess = Contains(writeAccess, "Users") || Contains(writeAccess, args.UserName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue