public void SetUp() {
			serverConfig = A.Fake<IServerConfig>();
			directoryEntryFactory = A.Fake<IDirectoryEntryFactory>();
			filterBuilde = new FilterBuilder(serverConfig);
			nameParser = new NameParser();
			adapter = new DirectoryEntryAdapter(serverConfig, directoryEntryFactory, filterBuilde, nameParser);
		}
 public void SetUp()
 {
     serverConfig          = A.Fake <IServerConfig>();
     directoryEntryFactory = A.Fake <IDirectoryEntryFactory>();
     filterBuilde          = new FilterBuilder(serverConfig);
     nameParser            = new NameParser();
     adapter = new DirectoryEntryAdapter(serverConfig, directoryEntryFactory, filterBuilde, nameParser);
 }
Exemple #3
0
 public FileSystemQuery(IDirectory directory, IDirectoryEntryFactory directoryEntryFactory, IShareCollectionFactory shareCollectionFactory)
 {
     VerifyArgument.IsNotNull("Directory", directory);
     VerifyArgument.IsNotNull("ShareCollectionFactory", shareCollectionFactory);
     _directory              = directory;
     _directoryEntryFactory  = directoryEntryFactory;
     _shareCollectionFactory = shareCollectionFactory;
 }
 public FileSystemQuery(IDirectory directory,IDirectoryEntryFactory directoryEntryFactory,IShareCollectionFactory shareCollectionFactory)
 {
     VerifyArgument.IsNotNull("Directory",directory);
     VerifyArgument.IsNotNull("DirectoryEntryFactory", directoryEntryFactory);
     VerifyArgument.IsNotNull("ShareCollectionFactory", shareCollectionFactory);
     _directory = directory;
     _directoryEntryFactory = directoryEntryFactory;
     _shareCollectionFactory = shareCollectionFactory;
 }
Exemple #5
0
 public TestAuthorizationServiceBase(IDirectoryEntryFactory directoryEntryFactory, ISecurityService securityService, bool isLocalConnection = true, bool areAdminsWarewolfMembers = true, bool overrideAreAdminsFn = false, bool overrideIsAdminMember = true)
     : base(directoryEntryFactory, securityService, isLocalConnection)
 {
     _overrideIsAdminMember = overrideIsAdminMember;
     if (overrideAreAdminsFn)
     {
         AreAdministratorsMembersOfWarewolfAdministrators = () => areAdminsWarewolfMembers;
     }
 }
 public DirectoryEntryAdapter(IServerConfig serverConfig,
                              IDirectoryEntryFactory directoryEntryFactory,
                              IFilterBuilder filterBuilder,
                              INameParser nameParser)
 {
     this.serverConfig          = serverConfig;
     this.directoryEntryFactory = directoryEntryFactory;
     this.filterBuilder         = filterBuilder;
     this.nameParser            = nameParser;
 }
Exemple #7
0
 public Container(ILdapConfig configuration)
 {
     nameParser            = new NameParser();
     directoryEntryFactory = new DirectoryEntryFactory();
     filterBuilder         = new FilterBuilder(configuration.Server);
     searcherFactory       = new SearcherFactory(configuration.Server, filterBuilder);
     directoryEntryAdapter = new DirectoryEntryAdapter(configuration.Server,
                                                       directoryEntryFactory,
                                                       filterBuilder,
                                                       nameParser);
     groupEntryAdapter = new GroupEntryAdapter(configuration.Groups, directoryEntryAdapter, searcherFactory, filterBuilder, nameParser);
     userEntryAdapter  = new UserEntryAdapter(configuration,
                                              directoryEntryAdapter,
                                              searcherFactory,
                                              filterBuilder,
                                              nameParser);
 }
Exemple #8
0
        protected AuthorizationServiceBase(IDirectoryEntryFactory directoryEntryFactory, ISecurityService securityService, bool isLocalConnection)
        {
            VerifyArgument.IsNotNull("SecurityService", securityService);
            VerifyArgument.IsNotNull("DirectoryEntryFactory", directoryEntryFactory);
            _securityService = securityService;
            _securityService.Read();
            _isLocalConnection = isLocalConnection;
            _securityService.PermissionsChanged  += (s, e) => RaisePermissionsChanged();
            _securityService.PermissionsModified += (s, e) => OnPermissionsModified(e);
            _directoryEntryFactory = directoryEntryFactory;

            AreAdministratorsMembersOfWarewolfAdministrators = delegate
            {
                var adGroup = FindGroup(new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null));
                using (var ad = directoryEntryFactory.Create("WinNT://" + Environment.MachineName + ",computer"))
                {
                    ad.Children.SchemaFilter.Add("group");
                    foreach (IDirectoryEntry dChildEntry in ad.Children)
                    {
                        if (dChildEntry.Name != "Warewolf Administrators")
                        {
                            continue;
                        }
                        var members = dChildEntry.Invoke("Members");

                        if (members == null)
                        {
                            continue;
                        }
                        foreach (var member in (IEnumerable)members)
                        {
                            if (IsGroupNameAdministrators(member, adGroup))
                            {
                                return(true);
                            }
                        }
                    }
                }

                return(false);
            };
        }
 public FileSystemQuery()
 {
     _directory = new DirectoryWrapper();
     _shareCollectionFactory = new ShareCollectionFactory();
     _directoryEntryFactory = new DirectoryEntryFactory();
 }
 public FileSystemQuery()
 {
     _directory = new DirectoryWrapper();
     _shareCollectionFactory = new ShareCollectionFactory();
     _directoryEntryFactory  = new DirectoryEntryFactory();
 }
 internal DirectoryEntryWrapper(DirectoryEntry wrapped, IDirectoryEntryFactory directoryEntryFactory)
 {
     _wrapped = wrapped;
     _nativeFactory = directoryEntryFactory;
 }