Пример #1
0
 public DataService(
     UserRepositoryBase userRepository,
     RoleRepositoryBase roleRepository,
     MessageRepositoryBase messageRepository,
     CommentRepositoryBase commentRepository
     )
 {
     _userRepository    = userRepository;
     _roleRepository    = roleRepository;
     _messageRepository = messageRepository;
     _commentRepository = commentRepository;
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrmRoleProviderTest"/> class.
        /// </summary>
        public CrmRoleProviderTest()
        {
            var cacheService   = Substitute.For <ICacheService>();
            var userRepository = Substitute.For <UserRepositoryBase>(cacheService);

            this.roleRepository = Substitute.For <RoleRepositoryBase>(userRepository, cacheService);

            this.roleRepositoryFactory = Substitute.For <IRoleRepositoryFactory>();
            this.roleRepositoryFactory.GetRepository(Arg.Any <ConfigurationSettings>()).Returns(this.roleRepository);

            var config = new NameValueCollection();

            config.Add("name", "crm");
            config.Add("applicationName", "CRM security provider");
            config.Add("readOnly", "false");
            config.Add("connectionStringName", "CRMConnString");

            this.crmRoleProvider = new CRMRoleProvider(this.roleRepositoryFactory);
            this.crmRoleProvider.Initialize(config["name"], config);

            this.role = new CRMRole("test", Guid.NewGuid());
        }
        /// <summary>
        /// Initializes the provider.
        /// </summary>
        /// <param name="name">The friendly name of the provider.</param>
        /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param>
        /// <exception cref="T:System.ArgumentNullException">The name of the provider is null.</exception>
        /// <exception cref="T:System.ArgumentException">The name of the provider has a length of zero.</exception>
        /// <exception cref="T:System.InvalidOperationException">An attempt is made to call <see cref="M:System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection)"/> on a provider after the provider has already been initialized.</exception>
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            try
            {
                Error.AssertLicense("Sitecore.MSCRM", "Microsoft Dynamics CRM security provider.");

                this.ApplicationName = config["applicationName"];
                this.ReadOnly        = (String.IsNullOrEmpty(config["readOnly"]) || config["readOnly"] == "true");

                var connectionStringName = config["connectionStringName"];
                var connectionString     = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;

                this.roleRepository = this.roleRepositoryFactory.GetRepository(Configuration.ConfigurationSettings.Parse(connectionString));
                this.initialized    = true;
            }
            catch (Exception e)
            {
                this.initialized = false;
                ConditionalLog.Error("The CRM provider couldn't be initialized.", e, this);
            }
        }
Пример #4
0
 public RoleService(RoleRepositoryBase repository, IUnitOfWork unitOfWork, IMapper mapper)
     : base(repository, unitOfWork, mapper)
 {
 }
Пример #5
0
 public RoleService(RoleRepositoryBase repository, IUnitOfWork unitOfWork, IMapper mapper)
     : base(repository, unitOfWork, mapper)
 {
 }
Пример #6
0
 public RoleService(RoleRepositoryBase roleRepository)
 {
     _roleRepository = roleRepository;
 }
Пример #7
0
 public RbacFilter(string module, RoleRepositoryBase roleRepo)
 {
     _module   = module;
     _roleRepo = roleRepo;
 }