private CmdletQueryProcessor(Match m) { this.SnapInName = m.Groups["snapinName"].Value; if (string.IsNullOrEmpty(this.SnapInName)) { this.SnapInName = "Microsoft.Exchange.Management.PowerShell.E2010"; } else if (this.SnapInName.IndexOf('.') == -1) { this.SnapInName = SnapInAliasMap.GetSnapInName(this.SnapInName); } this.CmdletName = m.Groups["cmdletName"].Value; this.QualifiedCmdletName = this.SnapInName + "\\" + this.CmdletName; CaptureCollection captures = m.Groups["parameterName"].Captures; if (captures.Count > 0) { this.ParameterNames = new string[captures.Count]; for (int i = 0; i < this.ParameterNames.Length; i++) { this.ParameterNames[i] = captures[i].Value; } } ADScope recipientReadScope = RbacQuery.CmdletQueryProcessor.CreateRbacScope(m.Groups["domainReadScope"].Value, false); ADScope configReadScope = RbacQuery.CmdletQueryProcessor.CreateRbacScope(m.Groups["configScope"].Value, false); ADScopeCollection[] recipientWriteScopes = null; CaptureCollection captures2 = m.Groups["domainWriteScope"].Captures; if (captures2.Count > 0) { List <ADScope> list = new List <ADScope>(captures2.Count); for (int j = 0; j < captures2.Count; j++) { ADScope adscope = RbacQuery.CmdletQueryProcessor.CreateRbacScope(captures2[j].Value, true); if (adscope != null) { list.Add(adscope); } } recipientWriteScopes = new ADScopeCollection[] { new ADScopeCollection(list) }; } this.ScopeSet = new ScopeSet(recipientReadScope, recipientWriteScopes, configReadScope, null); }
private static bool VerifyIsWithinScopes(ADRawEntry givenObject, List <ADScope> exclusiveScopes, List <ADScope> customScopes, ADScope readScope) { List <ADScopeCollection> list = null; ADScopeCollection exclusiveScopes2 = null; if (exclusiveScopes != null && exclusiveScopes.Count > 0) { exclusiveScopes2 = new ADScopeCollection(exclusiveScopes); } if (customScopes != null && customScopes.Count > 0) { list = new List <ADScopeCollection>(); list.Add(new ADScopeCollection(customScopes)); } ADScopeException ex; return(ADSession.TryVerifyIsWithinScopes(givenObject, readScope, list, exclusiveScopes2, true, out ex)); }