We have an issue with the way we are creating a Mutex
. The problem line is:
MutexAccessRule rule = new MutexAccessRule("Everyone", MutexRights.FullControl, AccessControlType.Allow);
The hardcoded "Everyone" string only works on English OSes, how do we change this line so it works in all languages?
The Everyone group includes all members of the Authenticated Users group as well as the built-in Guest account, and several other built-in security accounts like SERVICE, LOCAL_SERVICE, NETWORK_SERVICE , and others. A Guest account is a built-in account on a Windows system that is disabled by default.
Everyone encompasses all authenticated users (which could be from other domains trusted by the domain SharePoint resides in) where as Domain Users refers to users of just that particular domain.
Click the Security tab and select Authenticated Users (or click Add to add it if it is not already in the Group or user names box).
Google is being helpful today:
Looks like this will help
This code solves this problem:
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
MutexAccessRule rule = new MutexAccessRule(sid, MutexRights.FullControl, AccessControlType.Allow);
VB:
Dim sid As System.Security.Principal.SecurityIdentifier = New System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.WorldSid, Nothing)
Dim rule As System.Security.AccessControl.MutexAccessRule = New System.Security.AccessControl.MutexAccessRule(sid, System.Security.AccessControl.MutexRights.FullControl, System.Security.AccessControl.AccessControlType.Allow)
I had the same problem, but needed the actual localized string of the "Everyone" group name in order to enable access to a MessageQueue. Here's the solution I found, which works fine:
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
myMessageQueue.SetPermissions(acct.ToString(), MessageQueueAccessRights.FullControl);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With