コード例 #1
0
        public ActionResult Index()
        {
            AllRoles allRoles = new AllRoles();

            allRoles.Roles = (List <Role>) this._unitOfWork.Roles.GetAll();
            return(View(allRoles));
        }
コード例 #2
0
            public static void Postfix(OutroRoutine __instance)
            {
                try
                {
                    if (!IsLocalRolePlayer)
                    {
                        return;
                    }

                    var rolePlayer = AllRoles.Where(x => x.PlayerController.IsLocalPlayer).ToList()[0];
                    var roleOutro  = rolePlayer.RoleOutro;

                    roleOutro.ExecuteOutroMoveNext(rolePlayer);

                    if (!roleOutro.UseRoleOutro)
                    {
                        return;
                    }

                    __instance.field_Public_ABNGEPFHMHP_0.WinText.Text  = roleOutro.WinText;
                    __instance.field_Public_ABNGEPFHMHP_0.WinText.Color = roleOutro.WinTextColor;
                    __instance.field_Public_ABNGEPFHMHP_0.BackgroundBar.material.color = roleOutro.BackgroundColor;
                }
                catch { }
            }
コード例 #3
0
        /// <summary> 获取某一方全体武将 </summary>
        /// <param name="flag">要获取的方位 </param>
        /// <param name="sign">空缺位置是否为null</param>
        private List <Role> GetRoles(bool flag, bool sign)
        {
            var roles = new List <Role>();
            var rs    = flag ? FirstRoles : AfterRoles;

            if (!sign)
            {
                roles.AddRange(from item in rs.Values where AllRoles.ContainsKey(item) select AllRoles[item]);
            }
            else
            {
                for (int i = 1; i <= 5; i++)
                {
                    if (rs.ContainsKey(i))
                    {
                        var roleid = rs[i];
                        if (AllRoles.ContainsKey(roleid))
                        {
                            roles.Add(AllRoles[roleid]);
                        }
                    }
                    else
                    {
                        roles.Add(null);
                    }
                }
            }
            return(roles);
        }
コード例 #4
0
ファイル: Lover.cs プロジェクト: slimsy135/Town-Of-Us
        public void Win()
        {
            if (AllRoles.Where(x => x.RoleType == RoleEnum.Jester).Any(x => ((Jester)x).VotedOut))
            {
                return;
            }

            /*var lover1 = Player;
             * var lover2 = OtherLover.Player;
             * //System.Console.WriteLine("reached révoila");
             * lover1.Data.IsImpostor = true;
             * lover1.Data.IsDead = false;
             * lover2.Data.IsImpostor = true;
             * lover2.Data.IsDead = false;
             * foreach (var player in PlayerControl.AllPlayerControls)
             * {
             *  if (player.PlayerId == lover1.PlayerId) continue;
             *  if (player.PlayerId == lover2.PlayerId) continue;
             *  player.RemoveInfected();
             *  player.Die(0);
             *  player.Data.IsDead = true;
             *  player.Data.IsImpostor = false;
             * }*/

            LoveCoupleWins            = true;
            OtherLover.LoveCoupleWins = true;
        }
コード例 #5
0
        /// <summary> 攻击 </summary>
        /// <param name="roleid">攻击的武将Id</param>
        /// <param name="flag">是否全体攻击</param>
        /// <param name="sign">是否增加气力</param>
        private MovesVo Attack(Int64 roleid, bool flag, bool sign)
        {
            if (!AllRoles.ContainsKey(roleid))
            {
                return(null);
            }
            var roles = new List <Role>();
            var role  = AllRoles[roleid];

            if (sign)
            {
                role.angerCount += 1;
            }
            if (flag)
            {
                roles = GetRoles(!IsFirst, false);
            }
            else
            {
                var r = GetRole();
                if (r == null)
                {
                    return(null);
                }
                roles.Add(r);
            }
            Attack(role, roles, flag);
            var move = BuildMovesVo(role.id, roles.Select(m => Convert.ToDouble(m.id)).ToList());

            RemoveRoleState();
            return(move);
        }
コード例 #6
0
        public bool AddNewAccount(UplinkAccount acc)
        {
            var entity = _entityManager.GetEntity(acc.AccountHolder);

            if (entity.TryGetComponent(out MindComponent mindComponent))
            {
                if (!mindComponent.HasMind)
                {
                    return(false);
                }

                if (mindComponent.Mind !.AllRoles.Any(role => !role.Antagonist))
                {
                    return(false);
                }
            }

            if (_accounts.Contains(acc))
            {
                return(false);
            }

            _accounts.Add(acc);
            return(true);
        }
コード例 #7
0
        public async Task <IActionResult> ListOfUsers(string roleId)
        {
            try
            {
                var role = await roleManager.FindByIdAsync(roleId);

                if (role == null)
                {
                    ViewBag.Error = $"Role with id {roleId} is not found";
                    return(View("Error"));
                }
                var model = new AllRoles
                {
                    RoleId   = role.Id,
                    RoleName = role.Name
                };
                foreach (var user in userManager.Users.Where(x => x.Enable == true))
                {
                    if (await userManager.IsInRoleAsync(user, role.Name))
                    {
                        model.FirstName.Add(user.FirstName + " " + user.FatherName + " " + user.LastName);
                    }
                }
                return(View(model));
            }
            catch (Exception)
            {
                ViewBag.Error = "Something wrong";
                return(View("Error"));
            }
        }
コード例 #8
0
        private void EditConfirmResponseHandler(MsgBxResultMessage obj)
        {
            if (obj.Result == eMessageBoxResult.Yes)
            {
                //Edit Code
                SelectedRole.ParentRoleId = SelectedRole.ParentRole.Id;
                SelectedRole.ParentRole   = null;
                string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleUpdate);
                ActionResult <OrgRoleDTO> actionResult = JsonConvert.DeserializeObject <ActionResult <OrgRoleDTO> >(response);
                if (actionResult.ReturnCode == eReturnCode.Success)
                {
                    ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditSuccess"].ToString());
                }
                else
                {
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditError"].ToString());
                }
                FetchData();
                SelectedRole            = new OrgRoleDTO();
                SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
                RaisePropertyChanged("SelectedRole");
            }


            SelectedRole            = new OrgRoleDTO();
            SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
            RaisePropertyChanged("SelectedRole");
            Messenger.Default.Unregister <MsgBxResultMessage>(this, DeleteConfirmResponseHandler);
        }
コード例 #9
0
        private void SaveCommandHandler()
        {
            AppLogger.Instance.LogBegin(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            try
            {
                if (!_isEdit)
                {
                    //Add Code
                    SelectedRole.ParentRoleId = SelectedRole.ParentRole.Id;
                    SelectedRole.ParentRole   = null;
                    string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                    var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                    var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleCreate);
                    ActionResult <OrgRoleDTO> actionResult = JsonConvert.DeserializeObject <ActionResult <OrgRoleDTO> >(response);
                    if (actionResult.ReturnCode == eReturnCode.Success)
                    {
                        ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextRoleAddSuccess"].ToString());
                    }
                    else
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextRoleAddError"].ToString());
                    }
                    FetchData();

                    SelectedRole            = new OrgRoleDTO();
                    SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
                    RaisePropertyChanged("SelectedRole");
                }
                else
                {
                    if (SelectedRole.Id == SelectedRole.ParentRole.Id)
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextParentRoleModifiedToSelf"].ToString());
                        return;
                    }

                    if (!ValidateRoleEdit(SelectedRole.ParentRole))
                    {
                        ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                       Application.Current.MainWindow.Resources["txtMsgTextParentRoleModifiedToSelf"].ToString());
                        return;
                    }
                    Messenger.Default.Register <MsgBxResultMessage>(this, EditConfirmResponseHandler);
                    ShowMessageBox(eMessageBoxType.Confirmation, Application.Current.MainWindow.Resources["txtMsgTitleConfirm"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleEditConfirm"].ToString());
                    return;
                }
            }
            catch (Exception ex)
            {
                AppLogger.Instance.Log(eLogType.Error, ex.ToString());
            }
            finally
            {
                AppLogger.Instance.LogEnd(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
コード例 #10
0
            public static void Postfix(EjectRoutine __instance)
            {
                try
                {
                    var ejectedId = new PlayerData(__instance.field_Public_CNNGMDOPELD_0.LNMDIKCFBAK).PlayerController.PlayerId;
                    var available = AllRoles.Where(x => x.PlayerController.PlayerId == ejectedId);

                    if (available.Count() == 0)
                    {
                        return;
                    }

                    var rolePlayer  = available.ToList()[0];
                    var roleEjected = rolePlayer.RoleEjected;

                    roleEjected.ExecuteEjectMoveNext(rolePlayer);

                    if (!roleEjected.UseRoleEjected)
                    {
                        return;
                    }

                    var field = __instance.field_Public_CNNGMDOPELD_0;

                    field.EOFFAJKKDMI = roleEjected.EjectedText;
                }
                catch { }
            }
コード例 #11
0
        /// <summary> 组装出招Vo </summary>
        /// <param name="roleid"></param>
        /// <param name="hitids"></param>
        private MovesVo BuildMovesVo(Int64 roleid, List <double> hitids)
        {
            var move = new MovesVo
            {
                attackId = roleid,
                hitIds   = hitids,
                rolesA   = ConvertRoleFightVo(GetRoles(true, true)),
                rolesB   = ConvertRoleFightVo(GetRoles(false, true)),
                times    = Round
            };

            if (!FirstRoles.Any())
            {
                move.yinA = 0;
            }
            else
            {
                var dic = FirstRoles.First();
                move.yinA = AllRoles.ContainsKey(dic.Value) ? YinCount[AllRoles[dic.Value].user_id] : 0;
            }
            if (!AfterRoles.Any())
            {
                move.yinB = 0;
            }
            else
            {
                var dic = AfterRoles.First();
                move.yinB = AllRoles.ContainsKey(dic.Value) ? YinCount[AllRoles[dic.Value].user_id] : 0;
            }
            return(move);
        }
コード例 #12
0
 private string RoleFormat(FrameworkUser_View entity, object val)
 {
     if (AllRoles == null)
     {
         return("");
     }
     return(AllRoles.Where(x => entity.Roles.Contains(x.ID)).Select(x => x.RoleName).ToList().ToSpratedString());
 }
コード例 #13
0
ファイル: RolesCache.cs プロジェクト: markchan1209/SunEngine
        public virtual string CheckAndSetRoles(string roles)
        {
            if (string.IsNullOrWhiteSpace(roles))
                return string.Join(',', RoleNames.Unregistered, RoleNames.Registered);

            var rolesNames = roles.Split(',').Select(x => x.Trim()).ToList()
                .Where(x => AllRoles.ContainsKey(x));
            return string.Join(',', rolesNames);
        }
コード例 #14
0
        public IEnumerable <SelectListItem> EditableSelectedRoles()
        {
            var list = AllRoles.ToList();

            foreach (var item in AllRoles.Where(item => (VisibilityRoles ?? "").Contains(item.Text)))
            {
                item.Selected = true;
            }
            return(list);
        }
コード例 #15
0
        public RoleCached GetRole(string name)
        {
            lock (lockObject)
                if (_allRoles == null)
                {
                    Initialize();
                }

            return(AllRoles.TryGetValue(name, out var ret) ? ret : null);
        }
コード例 #16
0
        private void ClearFields(Pwds p)
        {
            NewUser.Username = string.Empty;
            NewUser.Email    = string.Empty;
            NewUser.CanUserChangePassword = false;
            NewUser.Roles.Clear();
            p.Pb1.Password = string.Empty;
            p.Pb2.Password = string.Empty;

            AllRolesFiltered.ReplaceWith(AllRoles.Select(x => x.Name).ToList());
        }
コード例 #17
0
        private void PopulateUserSessionWithIsInRole(IRequest req, IPrincipal user, IAuthSession session)
        {
            foreach (var role in AllRoles.Safe())
            {
                if (session.Roles.Contains(role))
                {
                    continue;
                }

                if (user.IsInRole(role))
                {
                    session.Roles.AddIfNotExists(role);
                }
            }
        }
コード例 #18
0
        private void DeleteConfirmResponseHandler(MsgBxResultMessage obj)
        {
            if (obj.Result == eMessageBoxResult.Yes)
            {
                string jsonObj     = JsonConvert.SerializeObject(SelectedRole);
                var    httpContent = new StringContent(jsonObj, Encoding.UTF8, "application/json");
                var    response    = HttpManager.Instance.Post(httpContent, APIPaths.RoleDelete);
                ActionResult <string> actionResult = JsonConvert.DeserializeObject <ActionResult <string> >(response);

                switch (actionResult.ReturnCode)
                {
                case eReturnCode.Success:
                    ShowMessageBox(eMessageBoxType.Info, Application.Current.MainWindow.Resources["txtMsgTitleSuccess"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelSuccess"].ToString());
                    break;

                case eReturnCode.Failure:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelError"].ToString());
                    break;

                case eReturnCode.EmployeeExists:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelErrorEmployeeExists"].ToString());
                    break;

                case eReturnCode.SubOrdinateExists:
                    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                                   Application.Current.MainWindow.Resources["txtMsgTextRoleDelErrorSubOrdinatesExists"].ToString());
                    break;
                }
                //else
                //{
                //    ShowMessageBox(eMessageBoxType.Error, Application.Current.MainWindow.Resources["txtMsgTitleError"].ToString(),
                //        Application.Current.MainWindow.Resources["txtMsgTextRoleDelError"].ToString());
                //}
                FetchData();
            }


            SelectedRole            = new OrgRoleDTO();
            SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
            RaisePropertyChanged("SelectedRole");

            Messenger.Default.Unregister <MsgBxResultMessage>(this, DeleteConfirmResponseHandler);
        }
コード例 #19
0
        public AddNewUserViewModel() : base()
        {
            StartCreateNewCommand   = new RelayCommand(pswd => CreateNew((Pwds)pswd), x => IsCreationAllowed(x));
            AddRoleCommand          = new RelayCommand(role => AddRole(role as String), x => IsCreationAllowed(x));
            RemoveRoleCommand       = new RelayCommand(role => RemoveRole(role as String), x => IsCreationAllowed(x));
            AddRolesCommand         = new RelayCommand(role => AddRoles(role), x => IsCreationAllowed(x));
            RemoveRolesCommand      = new RelayCommand(role => RemoveRoles(role), x => IsCreationAllowed(x));
            AddMultipleRolesCommand = new RelayCommand(group => AddMultipleRoles(group as string), x => IsCreationAllowed(x));

            NewUser = new UserData()
            {
                Email = string.Empty
            };
            AllRolesFiltered = new ObservableCollection <string>(AllRoles?.Select(x => x.Name)?.ToList());

            NewUser.PropertyChanged += NewUser_PropertyChanged;
        }
コード例 #20
0
ファイル: AzScope.cs プロジェクト: baoduy/HBD.Framework
        public override void Validate()
        {
            base.Validate();

            var dupRole = Roles.FirstOrDefault(i => AllRoles.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name)));

            if (dupRole != null)
            {
                throw new DuplicatedException(dupRole.Name);
            }

            var dupGroup = Groups.FirstOrDefault(i => AllGroups.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name)));

            if (dupRole != null)
            {
                throw new DuplicatedException(dupRole.Name);
            }
        }
コード例 #21
0
        //GET  /api/auth/getallroles
        public async Task <IActionResult> GetAllRoles()
        {
            AllRoles roles = await _accountsService.GetAllRoles();

            if (roles.IsNull)
            {
                return(new JsonResult(await Errors
                                      .GetGenericErrorResponse(
                                          new GetAllRolesResponse()
                {
                    ListOfAllRoles = null,
                    StatusCode = 400,
                    Error = "Server was unable to get a list of roles",
                    Description = "The server could not get the list of roles.",
                    Code = "server_was_unable_to_a_get_list_of_roles"
                })));
            }

            return(new JsonResult(Wrappyfier.WrapGetAllRolesResponse(roles._AllRoles)));
        }
コード例 #22
0
            public static void Postfix(IntroRoutine __instance)
            {
                try
                {
                    if (!IsLocalRolePlayer)
                    {
                        return;
                    }

                    var rolePlayer = AllRoles.Where(x => x.PlayerController.IsLocalPlayer).ToList()[0];
                    var roleIntro  = rolePlayer.RoleIntro;

                    roleIntro.ExecuteIntroMoveNext(rolePlayer);

                    if (!roleIntro.UseRoleIntro)
                    {
                        return;
                    }

                    var field = __instance.field_Public_PENEIDJGGAF_0;

                    __instance.isImpostor = roleIntro.IsRoleImpostor;

                    __instance.yourTeam = new Il2CppSystem.Collections.Generic.List <PlayerControlClass>();

                    foreach (var player in roleIntro.TeamPlayers)
                    {
                        __instance.yourTeam.Add(player.PlayerControl);
                    }

                    field.BackgroundBar.material.color = roleIntro.BackgroundColor;

                    field.ImpostorText.Text = roleIntro.RoleDescription;

                    field.ImpostorText.gameObject.SetActive(true);

                    field.Title.Text  = roleIntro.RoleName;
                    field.Title.Color = roleIntro.RoleNameColor;
                }
                catch { }
            }
コード例 #23
0
 private void CancelCommandHandler()
 {
     AppLogger.Instance.LogBegin(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     try
     {
         _isEdit                 = false;
         SelectedRole            = new OrgRoleDTO();
         SelectedRole.ParentRole = AllRoles.Where(r => r.ParentRoleId == 0).FirstOrDefault().Clone() as OrgRoleDTO;
         RaisePropertyChanged("SelectedRole");
         PageTitle = Application.Current.MainWindow.Resources["txtAddRole"].ToString();
         RaisePropertyChanged("PageTitle");
     }
     catch (Exception ex)
     {
         AppLogger.Instance.Log(eLogType.Error, ex.ToString());
     }
     finally
     {
         AppLogger.Instance.LogEnd(this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     }
 }
コード例 #24
0
        public async Task <AllRoles> GetAllRoles()
        {
            AllRoles roles = null;

            roles = await TryCatch <ArgumentNullException, AllRoles>(async() =>
            {
                AllRoles allRoles = new AllRoles()
                {
                    _AllRoles = await Task.FromResult(_roleManager.Roles.Select(x =>
                                                                                new GetAllRoles()
                    {
                        Id       = x.Id,
                        RoleName = x.Name
                    }).ToList())
                };

                return(allRoles);
            });

            return(roles ?? new AllRoles());
        }
コード例 #25
0
        /// <summary> 获取总攻击力给全局AllRoles赋值 </summary>
        private double GetAattackAndGiveAllRoles(PlayMatrix model)
        {
            double attack = 0;
            var    dic    = new Dictionary <Int64, Role>();

            if (model.r1 != null)
            {
                dic.Add(model.r1.id, model.r1);
                attack += model.r1.attack <= 0 ? 0 : model.r1.attack;
            }
            if (model.r2 != null)
            {
                dic.Add(model.r2.id, model.r2);
                attack += model.r2.attack <= 0 ? 0 : model.r2.attack;
            }
            if (model.r3 != null)
            {
                dic.Add(model.r3.id, model.r3);
                attack += model.r3.attack <= 0 ? 0 : model.r3.attack;
            }
            if (model.r4 != null)
            {
                dic.Add(model.r4.id, model.r4);
                attack += model.r4.attack <= 0 ? 0 : model.r4.attack;
            }
            if (model.r5 != null)
            {
                dic.Add(model.r5.id, model.r5);
                attack += model.r5.attack <= 0 ? 0 : model.r5.attack;
            }

            foreach (var item in dic)
            {
                AllRoles.Add(item.Key, item.Value);
                AllRolesHp.Add(item.Key, item.Value);
            }

            return(attack);
        }
コード例 #26
0
        public void LoadRoles(Guid?specificBusinessUnitId = null)
        {
            listView1.Items.Clear();

            var rManager = new RoleManager(service);
            var rootBuId = rManager.GetRootBusinessUnitId();

            AllRoles = rManager.GetRoles();

            listView1.Items.AddRange(AllRoles
                                     .Where(role => role.GetAttributeValue <EntityReference>("parentrootroleid").Id == role.Id)
                                     .Select(role => new ListViewItem
            {
                Text     = role.GetAttributeValue <string>("name"),
                SubItems =
                {
                    role.GetAttributeValue <EntityReference>("businessunitid").Name,
                    (rootBuId != role.GetAttributeValue <EntityReference>("businessunitid").Id).ToString()
                },
                ImageIndex      = 0,
                StateImageIndex = 0,
                Tag             = role
            }).ToArray());
        }
コード例 #27
0
        public override object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
        {
            var user     = authService.Request.GetUser();
            var userName = user.GetUserName();

            if (!LoginMatchesSession(session, userName))
            {
                authService.RemoveSession();
                session = authService.GetSession();
            }

            if (IsAuthorized(user))
            {
                session.IsAuthenticated = true;
                if (session.UserAuthName == null)
                {
                    session.UserAuthName = userName;
                }

                var aspReq = (HttpRequestBase)authService.Request.OriginalRequest;

                var loginUser    = aspReq.ServerVariables["LOGON_USER"].ToNullIfEmpty();
                var remoteUser   = aspReq.ServerVariables["REMOTE_USER"].ToNullIfEmpty();
                var identityName = aspReq.LogonUserIdentity != null ? aspReq.LogonUserIdentity.Name : null;
                session.DisplayName = loginUser
                                      ?? remoteUser
                                      ?? identityName;

                var tokens = new AuthTokens {
                    Provider    = Name,
                    UserName    = userName,
                    DisplayName = session.DisplayName,
                    Items       = new Dictionary <string, string> {
                        { "LOGON_USER", loginUser },
                        { "REMOTE_USER", remoteUser },
                        { "LogonUserIdentityName", identityName },
                    }
                };

                session.ReferrerUrl = GetReferrerUrl(authService, session, request);

                var response = OnAuthenticated(authService, session, tokens, new Dictionary <string, string>());

                if (session.Roles == null)
                {
                    session.Roles = new List <string>();
                }

                foreach (var role in AllRoles.Safe())
                {
                    if (user.IsInRole(role))
                    {
                        session.Roles.AddIfNotExists(role);
                    }
                }

                SaveSession(authService, session, SessionExpiry);

                if (response != null)
                {
                    return(response);
                }

                return(new AuthenticateResponse
                {
                    UserName = userName,
                    SessionId = session.Id,
                    DisplayName = session.DisplayName,
                    ReferrerUrl = request.Continue
                });
            }

            throw HttpError.Unauthorized(ErrorMessages.WindowsAuthFailed);
        }
コード例 #28
0
 public UserRoles()
 {
     roles = AllRoles.Where(x => x.Id == RoleId);
 }
コード例 #29
0
 private void AddMultipleRoles(string v) =>
 AllRoles.Where(role => role.DefaultGroup == v)
 .Select(role => role.Name)
 .ToList()
 .ForEach(role => AddRole(role));
コード例 #30
0
ファイル: RolesCache.cs プロジェクト: markchan1209/SunEngine
 public RoleCached GetRole(string name)
 {
     return AllRoles.TryGetValue(name, out var ret) ? ret : null;
 }