Exemplo n.º 1
0
        public IEnumerable <byte> ToBytes()
        {
            var bytes = new List <byte>();

            bytes.AddRange(Header.ToBytes());

            if (Questions != null && Questions.Any())
            {
                bytes.AddRange(Questions.SelectMany(qu => qu.ToBytes()));
            }
            if (Answers != null && Answers.Any())
            {
                bytes.AddRange(Answers.SelectMany(ans => ans.ToBytes()));
            }
            if (Authorities != null && Authorities.Any())
            {
                bytes.AddRange(Authorities.SelectMany(auth => auth.ToBytes()));
            }
            if (Additionals != null && Additionals.Any())
            {
                bytes.AddRange(Additionals.SelectMany(ads => ads.ToBytes()));
            }

            return(bytes);
        }
Exemplo n.º 2
0
        public void SaveAuthority(Authorities aut)
        {
            if (db.Authorities.Where(a => a.auth_id != aut.auth_id && (a.number == aut.number || a.en_name == aut.en_name)).Count() > 0)
            {
                throw new Exception("编号或EN名称已存在,保存失败");
            }

            if (aut.auth_id > 0)
            {
                //修改
                var au = GetAutById(aut.auth_id);
                if (au == null)
                {
                    throw new Exception("权限id不存在");
                }

                au.number          = aut.number;
                au.name            = aut.name;
                au.en_name         = aut.en_name;
                au.controller_name = aut.controller_name;
                au.action_name     = aut.action_name;
                au.fa_name         = aut.fa_name;
                au.btn_color       = aut.btn_color;
                au.comment         = aut.comment;
            }
            else
            {
                //新增
                db.Authorities.InsertOnSubmit(aut);
            }

            db.SubmitChanges();
        }
Exemplo n.º 3
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var isAuthorized = base.AuthorizeCore(httpContext);

            if (!isAuthorized)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(this.AccessLevels))
            {
                return(true);
            }
            else
            {
                UserPrincipal principal = (UserPrincipal)httpContext.User;

                string[] roles = this.AccessLevels.Split(',');

                foreach (string role in roles)
                {
                    AccessLevels level     = (AccessLevels)Enum.Parse(typeof(AccessLevels), role);
                    Authorities  authority = (Authorities)Enum.Parse(typeof(Authorities), this.Authority);

                    if (principal.IsInRole(level, authority))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        }
Exemplo n.º 4
0
        public ActionResult Create(string id)
        {
            //////
            var    stru   = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Organization).Structure_Code;
            var    modell = dbcontext.Authorities.ToList();
            string Code;

            if (modell.Count() == 0)
            {
                Code = stru + "1";
            }
            else
            {
                Code = stru + (modell.LastOrDefault().ID + 1).ToString();
            }
            /////
            ViewBag.author = dbcontext.Authority_Type.ToList().Select(m => new { ID = m.ID, Code = m.Code + "->" + m.Name });
            if (id != null)
            {
                var ID             = int.Parse(id);
                var Authority_Type = dbcontext.Authority_Type.FirstOrDefault(m => m.ID == ID);
                var model          = new Authorities {
                    Code = Code, Authority_TypeId = Authority_Type.ID.ToString(), Authority_Type = Authority_Type
                };
                return(View(model));
            }
            var mm = new Authorities();

            mm.Code = Code;
            return(View(mm));
        }
 public static Authority ToModel(this Authorities authorities)
 => new Authority
 {
     DisplayName = authorities.DisplayName,
     Id          = authorities.Id,
     Key         = authorities.Key
 };
Exemplo n.º 6
0
        public JsonResult SaveAuthority(FormCollection fc)
        {
            Authorities auth = new Authorities();

            MyUtils.SetFieldValueToModel(fc, auth);

            if (auth.number == null)
            {
                return(Json(new SRM(false, "编号不能为空")));
            }
            if (string.IsNullOrEmpty(auth.name))
            {
                return(Json(new SRM(false, "权限名不能为空")));
            }
            if (string.IsNullOrEmpty(auth.en_name))
            {
                return(Json(new SRM(false, "EN名称不能为空")));
            }

            try {
                new UASv().SaveAuthority(auth);
            }
            catch (Exception ex) {
                return(Json(new SRM(ex)));
            }

            WLog("权限管理", "保存权限:" + auth.name);

            return(Json(new SRM()));
        }
Exemplo n.º 7
0
        public Response(byte[] data)
        {
            Error     = "";
            TimeStamp = DateTime.Now;

            Header = new Header(data);

            using (PersistedReader reader = new PersistedReader(Header.Buffer, Header.Payload))
            {
                for (int intI = 0; intI < Header.QuestionCount; intI++)
                {
                    Questions.Add(new Question(reader));
                }

                for (int intI = 0; intI < Header.AnswersCount; intI++)
                {
                    Answers.Add(new Resource(reader));
                }

                for (int intI = 0; intI < Header.AuthorityCount; intI++)
                {
                    Authorities.Add(new Resource(reader));
                }

                for (int intI = 0; intI < Header.AdditionalCount; intI++)
                {
                    Additionals.Add(new Resource(reader));
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Authorities authorities = db.Authorities.Find(id);

            db.Authorities.Remove(authorities);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public void AddAuthority(DnsResourceRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            Authorities.Add(record);
        }
Exemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "Id,Name,Number,Message,Topic")] Authorities authorities)
 {
     if (ModelState.IsValid)
     {
         db.Entry(authorities).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(authorities));
 }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "Id,Name,Number,Message,Topic")] Authorities authorities)
        {
            if (ModelState.IsValid)
            {
                db.Authorities.Add(authorities);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(authorities));
        }
Exemplo n.º 12
0
 public ExternalInterfaces.IMessage GetExternalAnswer()
 {
     return(new ExternalConcretes.Message
     {
         Header = Header.ToExternal(),
         Questions = Questions.Select(qu => qu.ToExternal()),
         Answers = Answers.Select(ans => ans.ConvertToExternalType()),
         Authorities = Authorities.Select(auth => auth.ConvertToExternalType()),
         Additionals = Additionals.Select(adds => adds.ConvertToExternalType()),
     });
 }
Exemplo n.º 13
0
 public ActionResult Create(Authorities model)
 {
     try
     {
         ViewBag.author = dbcontext.Authority_Type.ToList().Select(m => new { ID = m.ID, Code = m.Code + "->" + m.Name });
         if (ModelState.IsValid)
         {
             Authorities record = new Authorities();
             record.Name             = model.Name;
             record.Description      = model.Description;
             record.Code             = model.Code;
             record.Authority_TypeId = model.Authority_TypeId;
             var ID = int.Parse(model.Authority_TypeId);
             record.Authority_Type    = dbcontext.Authority_Type.FirstOrDefault(m => m.ID == ID);
             record.Skill_Description = model.Skill_Description;
             var Authority_Type = dbcontext.Authorities.Add(record);
             dbcontext.SaveChanges();
             //=================================check for alert==================================
             var get_result_check = HR.Controllers.check.check_alert("athourities", HR.Models.user.Action.Create, HR.Models.user.type_field.form);
             if (get_result_check != null)
             {
                 var inbox = new Models.user.Alert_inbox {
                     send_from_user_id = User.Identity.Name, send_to_user_id = get_result_check.send_to_ID_user, title = get_result_check.Subject, Subject = get_result_check.Message
                 };
                 if (get_result_check.until != null)
                 {
                     if (get_result_check.until.Value.Year != 0001)
                     {
                         inbox.until = get_result_check.until;
                     }
                 }
                 ApplicationDbContext dbcontext = new ApplicationDbContext();
                 dbcontext.Alert_inbox.Add(inbox);
                 dbcontext.SaveChanges();
             }
             //===================================================================================
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(model));
         }
     }
     catch (DbUpdateException)
     {
         TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists;
         return(View(model));
     }
     catch (Exception e)
     {
         return(View(model));
     }
 }
Exemplo n.º 14
0
        // GET: Authorities/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Authorities authorities = db.Authorities.Find(id);

            if (authorities == null)
            {
                return(HttpNotFound());
            }
            return(View(authorities));
        }
Exemplo n.º 15
0
        /// <summary>
        /// process, add new authority for...
        /// submission choices...
        /// {"LADCode": "E00060060", "Name": "Widdicombe Sands" }
        /// {"TouchpointID":"0000000102", "LADCode": "E00060060", "Name": "Widdicombe Sands" }
        /// </summary>
        /// <param name="theTouchpoint">the touchpoint</param>
        /// <param name="usingContent">using content</param>
        /// <param name="inScope">in scope</param>
        /// <returns>the result of the operation</returns>
        public async Task <HttpResponseMessage> ProcessAddNewAuthorityFor(
            string theTouchpoint,
            string usingContent,
            IScopeLoggingContext inScope)
        {
            await inScope.EnterMethod();

            It.IsEmpty(theTouchpoint)
            .AsGuard <ArgumentNullException>(nameof(theTouchpoint));
            It.IsEmpty(usingContent)
            .AsGuard <ArgumentNullException>(nameof(usingContent));

            await inScope.Information($"deserialising the submitted content: '{usingContent}'");

            var theCandidate = JsonConvert.DeserializeObject <IncomingLocalAuthority>(usingContent);

            It.IsNull(theCandidate)
            .AsGuard <MalformedRequestException>(nameof(ILocalAuthority.LADCode));

            await inScope.Information("deserialisation complete...");

            if (It.IsEmpty(theCandidate.TouchpointID))
            {
                await inScope.Information($"applying missing touchpoint details: '{theTouchpoint}'");

                theCandidate.TouchpointID = theTouchpoint;
            }

            await inScope.Information($"validating the candidate: '{theCandidate.LADCode}'");

            await Authority.Validate(theCandidate);

            await inScope.Information($"validation complete...");

            await inScope.Information($"adding the candidate: '{theCandidate.LADCode}'");

            var result = await Authorities.Add(theCandidate);

            await inScope.Information($"candidate addition complete...");

            await inScope.Information($"preparing response...");

            var response = Respond.Created().SetContent(result);

            await inScope.Information($"preparation complete...");

            await inScope.ExitMethod();

            return(response);
        }
Exemplo n.º 16
0
        public void Dispose()
        {
            Questions.Clear();
            Answers.Clear();
            Authorities.Clear();
            Additionals.Clear();

            Questions   = null;
            Answers     = null;
            Authorities = null;
            Additionals = null;

            Header?.Dispose();
            Error = null;
        }
Exemplo n.º 17
0
 /// <summary>
 /// True iff the two objects are equal Layers.
 /// </summary>
 public bool Equals(DnsLayer other)
 {
     return(other != null &&
            Id.Equals(other.Id) &&
            IsQuery.Equals(other.IsQuery) &&
            OpCode.Equals(other.OpCode) &&
            IsAuthoritativeAnswer.Equals(other.IsAuthoritativeAnswer) &&
            IsTruncated.Equals(other.IsTruncated) &&
            IsRecursionDesired.Equals(other.IsRecursionDesired) &&
            IsRecursionAvailable.Equals(other.IsRecursionAvailable) &&
            FutureUse.Equals(other.FutureUse) &&
            IsAuthenticData.Equals(other.IsAuthenticData) &&
            IsCheckingDisabled.Equals(other.IsCheckingDisabled) &&
            ResponseCode.Equals(other.ResponseCode) &&
            (Queries.IsNullOrEmpty() && other.Queries.IsNullOrEmpty() || Queries.SequenceEqual(other.Queries)) &&
            (Answers.IsNullOrEmpty() && other.Answers.IsNullOrEmpty() || Answers.SequenceEqual(other.Answers)) &&
            (Authorities.IsNullOrEmpty() && other.Authorities.IsNullOrEmpty() || Authorities.SequenceEqual(other.Authorities)) &&
            (Additionals.IsNullOrEmpty() && other.Additionals.IsNullOrEmpty() || Additionals.SequenceEqual(other.Additionals)));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Creates a Layer that represents the datagram to be used with PacketBuilder.
 /// </summary>
 public override ILayer ExtractLayer()
 {
     return(new DnsLayer
     {
         Id = Id,
         IsQuery = IsQuery,
         OpCode = OpCode,
         IsAuthoritativeAnswer = IsAuthoritativeAnswer,
         IsTruncated = IsTruncated,
         IsRecursionDesired = IsRecursionDesired,
         IsRecursionAvailable = IsRecursionAvailable,
         FutureUse = FutureUse,
         IsAuthenticData = IsAuthenticData,
         IsCheckingDisabled = IsCheckingDisabled,
         ResponseCode = ResponseCode,
         Queries = Queries.ToList(),
         Answers = Answers.ToList(),
         Authorities = Authorities.ToList(),
         Additionals = Additionals.ToList(),
     });
 }
Exemplo n.º 19
0
        /// <summary>
        /// process, delete (the) local authority for...
        /// </summary>
        /// <param name="theTouchpoint">the touchpoint</param>
        /// <param name="theLADCode">the local adinistrative district code</param>
        /// <param name="inScope">in scope</param>
        /// <returns>the result of the operation</returns>
        public async Task <HttpResponseMessage> ProcessDeleteAuthorityFor(
            string theTouchpoint,
            string theLADCode,
            IScopeLoggingContext inScope)
        {
            await inScope.EnterMethod();

            It.IsEmpty(theTouchpoint)
            .AsGuard <ArgumentNullException>(nameof(theTouchpoint));
            It.IsEmpty(theLADCode)
            .AsGuard <ArgumentNullException>(nameof(theLADCode));

            await inScope.Information($"seeking the admin district: '{theLADCode}'");

            var result = await Authorities.Get(theLADCode);

            It.IsNull(result)
            .AsGuard <NoContentException>();

            await inScope.Information($"candidate search complete: '{result.LADCode}'");

            await inScope.Information($"validating touchpoint integrity: '{result.TouchpointID}' == '{theTouchpoint}'");

            (result.TouchpointID != theTouchpoint)
            .AsGuard <NoContentException>(NoContentException.GetMessage(theTouchpoint));

            await inScope.Information($"deleting authority: '{result.Name}'");

            await Authorities.Delete(theLADCode);

            await inScope.Information($"preparing response...");

            var response = Respond.Ok();

            await inScope.Information($"preparation complete...");

            await inScope.ExitMethod();

            return(response);
        }
Exemplo n.º 20
0
        public ActionResult AuthorityAdd(Authorities authorities)
        {
            ViewBag.AllUrl = GetAsssemblyUrl();
            bool flag = true;

            IAuthorities[] list = irep.GetAllAuthorities();
            foreach (var item in list)
            {
                if (item.Url == authorities.Url || item.Authority_Name == authorities.Authority_Name)
                {
                    flag = false;
                }
            }
            if (ModelState.IsValid && flag)
            {
                irep.AddAuthority(authorities);
                return(RedirectToAction("AuthorityManage", "Home"));
            }
            else
            {
                ModelState.AddModelError("", "该权限已存在");
                return(View());
            }
        }
 /// <summary>
 ///
 /// </summary>
 public VLAuthorizeAttribute(params SystemAuthority[] authorities)
 {
     Authorities.AddRange(authorities.Select(c => (long)c));
 }
Exemplo n.º 22
0
 public ActionResult AuthorityUpdate(Authorities authority)
 {
     irep.SaveAuthority(authority);
     return(RedirectToAction("AuthorityManage", "Home"));
 }
Exemplo n.º 23
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("GetJoinedSquaresResponse(");
        bool __first = true;

        if (Squares != null && __isset.squares)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Squares: ");
            Squares.ToString(sb);
        }
        if (Members != null && __isset.members)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Members: ");
            Members.ToString(sb);
        }
        if (Authorities != null && __isset.authorities)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Authorities: ");
            Authorities.ToString(sb);
        }
        if (Statuses != null && __isset.statuses)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Statuses: ");
            Statuses.ToString(sb);
        }
        if (ContinuationToken != null && __isset.continuationToken)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ContinuationToken: ");
            ContinuationToken.ToString(sb);
        }
        if (NoteStatuses != null && __isset.noteStatuses)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("NoteStatuses: ");
            NoteStatuses.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Exemplo n.º 24
0
        /// <summary>
        /// Populate Region Counrty Sector Document
        /// </summary>
        /// <param name="languageID"></param>
        public void PopulateSearchFilter(Guid languageID)
        {
            //Countries
            var countries = CountryService.GetCountries(languageID);

            Countries = new List <KeyValue>();

            foreach (var country in countries)
            {
                Countries.Add(new KeyValue {
                    Key = country.ID.ToString(), Value = country.Name
                });
            }

            //this.Countries.Insert(0, new KeyValue { Key = "", Value = "Country" });

            //regions
            var regions = RegionService.GetRegions(languageID).OrderBy(r => r.Region.Type).ThenBy(r => r.Name);

            this.Regions = new List <GroupedSelectListItem>();

            foreach (var region in regions)
            {
                this.Regions.Add(new GroupedSelectListItem
                {
                    GroupKey  = region.Region.Type == RegionType.Economical ? "2" : "1",
                    GroupName = region.Region.Type == RegionType.Economical ? "Economical" : "Geographical",
                    Text      = region.Name,
                    Value     = region.ID.ToString()
                });
            }

            //this.Regions.Insert(0, new GroupedSelectListItem { GroupKey = "", GroupName = "", Text = "Region", Value = "" });

            //Authority
            Guid authorityID   = new Guid(AppSettingsUtility.GetString(AppSettingsKeys.AuthorityVariableID));
            var  listauthority = SearchServices.GetAuthority(languageID, authorityID);

            this.Authorities = new List <KeyValue>();
            Authorities.Add(new KeyValue {
                Key = "", Value = "--Select One --"
            });
            foreach (var authorities in listauthority)
            {
                Authorities.Add(new KeyValue {
                    Key = authorities.ToString(), Value = authorities.ToString()
                });
            }

            //Documents
            Guid documentTypeVariableID = new Guid(AppSettingsUtility.GetString(AppSettingsKeys.DocumentTypeVariableID));
            var  choiceLanguages        = VariableService.GetChoiceOptions(languageID, documentTypeVariableID);

            this.DocumentTypes = new List <KeyValue>();

            foreach (var choiceLanguage in choiceLanguages)
            {
                this.DocumentTypes.Add(new KeyValue {
                    Key = choiceLanguage.ID.ToString(), Value = choiceLanguage.Name
                });
            }
        }
Exemplo n.º 25
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            ApplicationDbContext context = app.ApplicationServices
                                           .CreateScope().ServiceProvider.GetRequiredService <ApplicationDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }
            if (!context.Students.Any())
            {
                TypeOfAdmission admissionType = new TypeOfAdmission()
                {
                    Name = "TestAdmissionType"
                };
                Authorities localAuth = new Authorities()
                {
                    Name = "Администрация Томской области",
                };
                MunicipalUnit municipal = new MunicipalUnit()
                {
                    Name = "Г. Томск",
                };
                TypeAuthorities typeAuthorities = new TypeAuthorities()
                {
                    Name        = "Исполнительный орган",
                    Authorities = localAuth
                };
                EduOrg technikum = new EduOrg()
                {
                    Name    = "Техникум",
                    Address = new Address
                    {
                        MunicipalUnit = "Томск",
                        Okrug         = "Сибирский Федеральный округ",
                        Region        = "Томская область"
                    },
                    Phone           = "899999999",
                    Latitude        = 2.34225,
                    Longiitude      = 4.34564,
                    License         = false,
                    MunitipalUnit   = municipal,
                    Authoritiies    = localAuth,
                    TypeAuthorities = typeAuthorities
                };
                EduOrg college = new EduOrg()
                {
                    Name    = "College",
                    Address = new Address()
                    {
                        MunicipalUnit = "Томск",
                        Okrug         = "Сибирский Федеральный округ",
                        Region        = "Томская область"
                    },
                    Phone           = "899999999",
                    Latitude        = 2.3677,
                    Longiitude      = 8.34,
                    License         = false,
                    MunitipalUnit   = municipal,
                    Authoritiies    = localAuth,
                    TypeAuthorities = typeAuthorities
                };
                EduProgramType eduProgramType = new EduProgramType()
                {
                    Name = "СПО"
                };
                Speciality programmer = new Speciality()
                {
                    Name        = "Программист",
                    ProgramType = eduProgramType,
                    Code        = "8989"
                };
                context.Students.AddRange(
                    new Student
                {
                    AppEduPositions = new AppEduPosition()
                    {
                        ApplicationForm = new ApplicationForm()
                        {
                            AppDate   = DateTime.Now,
                            Applicant = new Applicant()
                            {
                                FirstName  = "Игорь",
                                SecondName = "Петров",
                                Birthday   = DateTime.Today,
                                Address    = new Address()
                                {
                                    Region = "Московская область",
                                    Okrug  = "Центральный Федеральный округ"
                                },
                                Privileged = true
                            },
                            Organization = technikum
                        },
                        AdmissionPlan = new AdmissionPlan()
                        {
                            Year              = new DateTime(2015, 1, 1),
                            AdmissionNumber   = 1,
                            TargetedAdmission = true,
                            TypeOfAdmission   = admissionType,
                            EduProgram        = new EduProgram()
                            {
                                ProgramType   = eduProgramType,
                                Speciality    = programmer,
                                Qualification = new Qualification()
                                {
                                    Name       = ".NET",
                                    Speciality = programmer
                                },
                                Form = new EduForm()
                                {
                                    Name = "Очная"
                                },
                                Level = new EduLvl()
                                {
                                    Name = "1"
                                },
                                Base = new EduBase()
                                {
                                    Name = "Бюджетная основа"
                                },
                                Organization = technikum
                            }
                        }
                    },
                    Date = DateTime.Now
                },
                    new Student
                {
                    AppEduPositions = new AppEduPosition()
                    {
                        ApplicationForm = new ApplicationForm()
                        {
                            AppDate   = DateTime.Now,
                            Applicant = new Applicant()
                            {
                                FirstName  = "Аркадий",
                                SecondName = "Победоносцев",
                                Birthday   = DateTime.Today,
                                Address    = new Address
                                {
                                    MunicipalUnit = "Томск",
                                    Okrug         = "Сибирский Федеральный округ",
                                    Region        = "Томская область"
                                },
                                Privileged = true
                            },
                            Organization = college
                        },
                        AdmissionPlan = new AdmissionPlan()
                        {
                            Year              = new DateTime(2015, 1, 1),
                            AdmissionNumber   = 1,
                            TargetedAdmission = true,
                            TypeOfAdmission   = admissionType,
                            EduProgram        = new EduProgram()
                            {
                                ProgramType   = eduProgramType,
                                Speciality    = programmer,
                                Qualification = new Qualification()
                                {
                                    Name       = "JS",
                                    Speciality = programmer
                                },
                                Form = new EduForm()
                                {
                                    Name = "Очно-заочная"
                                },
                                Level = new EduLvl()
                                {
                                    Name = "1"
                                },
                                Base = new EduBase()
                                {
                                    Name = "Платная основа"
                                },
                                Organization = college
                            }
                        }
                    },
                    Date = DateTime.Now
                }
                    );
                context.SaveChanges();
            }
        }
Exemplo n.º 26
0
 public DescribeAttribute(CommandType type, Authorities auth, string desc)
 {
     Desc = desc;
     Type = type;
     Auth = auth;
 }
Exemplo n.º 27
0
        public bool IsInRole(AccessLevels accessLevel, Authorities authority)
        {
            UserDetails userInfo = this.UserManager.GetUserDetailsByAccessToken(this.AccessToken);

            return(userInfo.AccessInfo.Any(x => (x.AccessLevel == accessLevel) && (x.Authority == authority)));
        }
Exemplo n.º 28
0
 public AuthoritiesAttribute(Authorities allowedAuthorities)
 {
     AllowedAuthorities = allowedAuthorities;
 }