示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddIdentity<MUser, IdentityRole>() .AddEntityFrameworkStores();
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(o => o.LoginPath = new PathString("/Account/Login"));


            services.AddDistributedMemoryCache();
            services.AddSession(options =>
            {
                options.CookieName  = ".MyApp.Session";
                options.IdleTimeout = TimeSpan.FromSeconds(3600);
            });
            services.AddMvc();

            //MEDMDefModel.MainDef.Load(Path.Combine(BaseDir, "Model", "CNTIModel.xml"));
            RZDMonitoringModel.ConnectionPool.ConnectionString = Configuration.GetConnectionString("DefaultConnection");
            RZDMonitoringModel.Store = new MEDMStore(Configuration.GetSection("Store").GetSection("Path").Value);

            EDMTrace.IsEnabled = true;
            RZDMonitoringModel bm = new RZDMonitoringModel();

            bm.BaseDir = BaseDir;
            bm.Init();

            services.AddScoped <RZDMonitoringModel>();
            services.AddSingleton <IConfigurationRoot>(Configuration);
        }
示例#2
0
        public override object Run(RZDMonitoringModel model, string path, string parms)
        {
            MUser currentUser = CurrentUser(model);

            // Чтение списка
            MPaginationList l = new MPaginationList(parms);

            return(l);
        }
示例#3
0
        public override object Run(RZDMonitoringModel model, string path, string parms)
        {
            MUser currentUser = CurrentUser(model);

            // Чтение списка
            MPaginationList l = new MPaginationList(parms);

            model.Select(l, typeof(MLang), $"select  * from [MLang] (nolock) ");
            return(l);
        }
示例#4
0
        public IActionResult Login(RZDMonitoringModel model, string login, string password)
        {
            try
            {
                if (login == null)
                {
                    login = "";
                }
                if (password == null)
                {
                    password = "";
                }

                if (login == "" && password == "")
                {
                    login    = "******";
                    password = "******";
                }

                MUser user = model.SelectFirst <MUser>($"select * from [MUser] (nolock) where Login={model.AddParam(login)}");
                if (user != null)
                {
                    if (user.PassCode == MFunc.GetSecurityHash(password))
                    {
                        model.AddUser(user, login);
                        SetAuth(login);
                    }
                    else
                    {
                        throw new NotAuthException($@"Неправильный пароль...");
                    }
                }
                else
                {
                    throw new NotAuthException($@"Пользователь ""{login}"" не найден...");
                }

                return(Json(new MJsonResult(MJsonResultType.OK, null)));
            }
            catch (Exception e)
            {
                return(Json(new MJsonResult(MJsonResultType.Error, e.Message)));
            }
        }
示例#5
0
 public DataController(RZDMonitoringModel model) : base(model)
 {
 }
示例#6
0
 public TemplatesController(RZDMonitoringModel model) : base(model)
 {
 }
示例#7
0
 public virtual object Run(RZDMonitoringModel model, string path, string parms)
 {
     return(base.Run(model, path, parms));
 }