示例#1
0
        public INetworkGuestRepository GetNetworkGuestRepository()
        {
            if (_networkGuestRepository == null)
            {
                _networkGuestRepository = GetRepository(x => x.GetNetworkGuestRepository());
            }

            return(_networkGuestRepository);
        }
        public INetworkGuestRepository GetNetworkGuestRepository()
        {
            if (_networkGuestRepository == null)
            {
                var networkRepository = GetNetworkRepositoryWithoutGuests();
                var userRepository    = GetRepository(x => x.GetUserRepository());

                _networkGuestRepository = new NetworkGuestRepository(_connection, networkRepository, userRepository);
            }

            return(_networkGuestRepository);
        }
示例#3
0
        public static void Copy(this INetworkGuestRepository repository, Network source, Network destination)
        {
            var users = repository.Get(source);

            foreach (var user in users)
            {
                if (!repository.Check(destination, user))
                {
                    repository.Add(destination, user);
                }
            }
        }
示例#4
0
文件: Helpers.cs 项目: Mavtak/roomie
        public static void AddUserAndCopyAccess(IUserRepository userRepository, INetworkRepository networkRepository, INetworkGuestRepository networkGuestRepository, string username, string password, string referenceUsername)
        {
            var user = User.Create(string.Join(":", "internal", username));
            user.Secret = Web.Persistence.Helpers.Secrets.BCryptSecret.FromPassword(password);

            userRepository.Add(user);

            var referenceUser = userRepository.Get(string.Join(":", "internal", referenceUsername));

            var networks = networkRepository.Get(referenceUser);

            foreach (var network in networks)
            {
                networkGuestRepository.Add(network, user);
            }
        }
 public GuestEnabledDeviceRepository(IDeviceRepository devices, INetworkGuestRepository guests)
 {
     _devices = devices;
     _guests  = guests;
 }
 public GuestEnabledNetworkRepository(INetworkRepository networks, INetworkGuestRepository guests)
 {
     _networks = networks;
     _guests   = guests;
 }
 public GuestEnabledDeviceRepository(IDeviceRepository devices, INetworkGuestRepository guests)
 {
     _devices = devices;
     _guests = guests;
 }
示例#8
0
        public static void AddUserAndCopyAccess(IUserRepository userRepository, INetworkRepository networkRepository, INetworkGuestRepository networkGuestRepository, string username, string password, string referenceUsername)
        {
            var user = User.Create(string.Join(":", "internal", username));

            user.Secret = Web.Persistence.Helpers.Secrets.BCryptSecret.FromPassword(password);

            userRepository.Add(user);

            var referenceUser = userRepository.Get(string.Join(":", "internal", referenceUsername));

            var networks = networkRepository.Get(referenceUser);

            foreach (var network in networks)
            {
                networkGuestRepository.Add(network, user);
            }
        }
 public GuestEnabledNetworkRepository(INetworkRepository networks, INetworkGuestRepository guests)
 {
     _networks = networks;
     _guests = guests;
 }