// 呼叫service, 將資料新增至資料庫(edit)
        public Boolean editAuthorization()
        {
            this._authoService = new AuthorizationService(this._authoModel);
            if (this._authoModel.GetAuthoName() == "")
            {
                MessageBox.Show("請輸入權限名稱");
                return false;
            }
            else if(this._authoModel.GetAuthoValue() == "")
            {
                MessageBox.Show("請輸入權限數值");
                return false;
            }

            if (_authoService.EditAuthorization())
                MessageBox.Show("修改成功!");
            else
            {
                MessageBox.Show("修改失敗!");
                return false;
            }
                
            
            return true;
        }
        //呼叫service 利用authoID查詢autho資料
        public AuthorizationPresentationModel SearchDataByAuthoID()
        {
            AuthorizationPresentationModel authoPresentModel = new AuthorizationPresentationModel();

            if (this._authoModel.GetAuthoID() == null || this._authoModel.GetAuthoID() == "")
                MessageBox.Show("請輸入權限ID");
            else
            {
                //MessageBox.Show("yes");
                _authoService = new AuthorizationService(this._authoModel);
                _authoModel = _authoService.searchByAuthoID();

                authoPresentModel.SetAuthoID(_authoModel.GetAuthoID());
                authoPresentModel.SetAuthoName(_authoModel.GetAuthoName());
                authoPresentModel.SetAuthoValue(_authoModel.GetAuthoValue());

                if(_authoModel.GetAuthoName() == null || _authoModel.GetAuthoName() == "")
                {
                    MessageBox.Show("此權限ID不存在!");
                    //MessageBox.Show(_authoModel.GetAuthoID());
                    authoPresentModel.SetAuthoID(null);
                }
            }
            return authoPresentModel;
        }
        public void AuthorizationUser()
        {
            this.SetupData();

            IList<string> operationCodes = new List<string> { "feature" };
            var result = new AuthorizationService().RetrieveAllowedOperations(operationCodes);
            Assert.IsNotNull(result);
        }
Exemplo n.º 4
0
		public LoginViewModel(Window currentWindow)
		{
			this.currentWindow = currentWindow;
			CreateLoginCommand();
			CreateSigninCommand();
			AuthorizationService = new AuthorizationService();
			UserService = new UserService();

			Password = "******";
			UserName = "******";
		}
Exemplo n.º 5
0
 public MainServerButton(AuthorizationService authorizationService, IRegionManager regionManager)
 {
     mAuthorizationService = authorizationService;
     mRegionManager = regionManager;
     InitializeComponent();
     Loaded += (sender, args) =>
     {
         if (mAuthorizationService.UserType != UserType.Manager )
         {
             mRegionManager.Regions[RegionNames.MAIN_BUTTON_REGION].Remove(this);
         }
     };
 }
        public void AuthorizationServiceCanDisconnectFromClearingHouse()
        {
            //Setup
            var authorizationService = new AuthorizationService(CLEARING_HOUSE_ADDRESS, CLIENT_ID, CLIENT_SECRET, _scopes);

            //Execute
            authorizationService.ConnectToClearingHouse();
            var wasSuccessful = authorizationService.DisconnectFromClearingHouse();

            //Verify
            wasSuccessful.ShouldBeTrue();

            //Teardown
        }
        // 呼叫service將資料新增至資料庫
        public void AddAuthorization()
        {
            this._authoService = new AuthorizationService(_authoModel);

            int errorFlag = 0;

            if (this._authoModel.GetAuthoID() == "" || this._authoModel.GetAuthoName() == "" || this._authoModel.GetAuthoValue() == "")
            {
                MessageBox.Show("尚有欄位為空白, 請重新確認是否填寫完畢!");
                errorFlag = 1;
            }

            if (errorFlag == 1)
                return;

            if (_authoService.AddAuthorization())
                MessageBox.Show("新增成功!");
            else
                MessageBox.Show("新增失敗!");
        }
        public KeyDatesControllerTests()
        {
            mediator = A.Fake<IMediator>();
            authorizationService = A.Fake<AuthorizationService>();

            A.CallTo(
                () => mediator.SendAsync(A<GetKeyDatesSummaryInformation>.That.Matches(p => p.NotificationId == notificationId)))
                .Returns(new KeyDatesSummaryData
                {
                    Dates = new NotificationDatesData
                    {
                        NotificationId = notificationId,
                        NotificationReceivedDate = notificationReceivedDate,
                        PaymentReceivedDate = paymentReceivedDate,
                        AcknowledgedDate = acknowledgedDate,
                        DecisionRequiredDate = decisionRequiredDate
                    }
                });

            controller = new KeyDatesController(mediator, authorizationService);
        }
        public void AuthorizationServiceCanRetriveAccessToken()
        {
            //Setup
            this._autoResetEvent = new AutoResetEvent(false);
            var authorizationService = new AuthorizationService(CLEARING_HOUSE_ADDRESS, CLIENT_ID, CLIENT_SECRET, _scopes);

            authorizationService.AccessResponseReceived += accessResponse =>
            {
                accessResponse.AccessToken.ShouldNotBeNull();
                this._autoResetEvent.Set();
            };

            //Execute
            authorizationService.ConnectToClearingHouse();
            authorizationService.RetriveAccessToken();

            //Verify
            this._autoResetEvent.WaitOne();

            //Teardown
            authorizationService.DisconnectFromClearingHouse();
        }
Exemplo n.º 10
0
 public MessageListener(Subscriber subscriber, Publisher publisher)
 {
     _authService  = new AuthorizationService(publisher);
     _subscription = Init(subscriber);
 }
Exemplo n.º 11
0
        public static void RegisterActions(ApplicationDbContext context)
        {
            var q = from type in Assembly.GetExecutingAssembly().GetTypes()
                    where type.IsClass && type.Namespace != null && type.Namespace.Contains("Controller")
                    select type;
            List <string> activeActions = new List <string>();

            foreach (Type controller in q)
            {
                var actions = controller.GetMethods().ToList();
                foreach (MethodInfo mi in actions)
                {
                    AuthorizationService attribute = mi.GetCustomAttribute(typeof(AuthorizationService), false) as AuthorizationService;
                    if (attribute != null)
                    {
                        var actionName = mi.Name;
                        ActionNameAttribute customAction = mi.GetCustomAttribute(typeof(ActionNameAttribute), false) as ActionNameAttribute;
                        if (customAction != null)
                        {
                            actionName = customAction.Name;
                        }
                        string controllerName      = controller.Name.Substring(0, controller.Name.Length - 10);
                        bool   isHttpPost          = mi.GetCustomAttributes(typeof(HttpPostAttribute)).Count() > 0;
                        bool   isBackGroundProcess = mi.ReturnType != typeof(ActionResult) && mi.ReturnType != typeof(IActionResult);
                        var    action = context.ApplicationAction.Where(p => p.ActionName == actionName && p.ControllerName == controllerName).FirstOrDefault();
                        // && p.IsHttpPOST == isHttpPost)
                        var affected = 0;
                        if (action == null)
                        {
                            action = new ApplicationAction
                            {
                                ApplicationAction_Id = $"{controllerName} - {actionName}",
                                ActionName           = actionName,
                                ControllerName       = controllerName,
                                AccessNeeded         = attribute.Assignable,
                                IsHttpPOST           = isHttpPost,
                                Description          = attribute.ActionDescription
                            };
                            context.ApplicationAction.Add(action);
                        }
                        else
                        {
                            action.ApplicationAction_Id = $"{controllerName} - {actionName}";
                            action.ActionName           = actionName;
                            action.ControllerName       = controllerName;
                            action.AccessNeeded         = attribute.Assignable;
                            action.IsHttpPOST           = isHttpPost;
                            action.Description          = attribute.ActionDescription;
                            context.ApplicationAction.Update(action);
                        }
                        affected = context.SaveChanges();
                        if (affected > 0)
                        {
                            activeActions.Add(action.Id);
                        }
                    }
                }
            }

            if (activeActions.Any())
            {
                var actionsToRemove = context.ApplicationAction.Where(a => !activeActions.Contains(a.Id)).ToList();
                if (actionsToRemove.Count > 0)
                {
                    context.RemoveRange(actionsToRemove);
                    context.SaveChanges();
                }

                AJMPActionPermission aJMPActionPermission = new AJMPActionPermission(context);
                aJMPActionPermission.Setup();
            }
            else
            {
                if (context.ApplicationAction.Any())
                {
                    context.ApplicationAction.RemoveRange(context.ApplicationAction.ToList());
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 12
0
 public Task <bool> IsGrantedAsync(string policyName)
 {
     return(AuthorizationService.IsGrantedAsync(policyName));
 }
Exemplo n.º 13
0
 public AuthorizationValidatorFactory(WorkflowType workflowType, AuthorizationService authorizationService)
 {
     _workflowType         = workflowType;
     _authorizationService = authorizationService;
 }
Exemplo n.º 14
0
 protected virtual async Task <bool> IsCurrentUserManagerAsync()
 {
     return(await AuthorizationService.IsGrantedAsync(BasketsPermissions.BasketItem.Manage));
 }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(142, 6, true);
            WriteLiteral("\r\n\r\n\r\n");
            EndContext();
#line 7 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"

            ViewData["Title"] = "Players";

#line default
#line hidden
            BeginContext(191, 237, true);
            WriteLiteral("\r\n<div class=\"container container-fluid bg-white\">\r\n    <div class=\"row\">\r\n        <div class=\"col-md-12\">\r\n            <h3>All Players</h3>\r\n        </div>\r\n    </div>\r\n    <div class=\"row\">\r\n        <div class=\"col-md-4\">\r\n            ");
            EndContext();
            BeginContext(428, 455, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d15418", async() => {
                BeginContext(466, 150, true);
                WriteLiteral("\r\n                <div class=\"form-actions no-color\">\r\n                    <p>\r\n                        Search: <input type=\"text\" name=\"searchString\"");
                EndContext();
                BeginWriteAttribute("value", " value=\"", 616, "\"", 650, 1);
#line 22 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                WriteAttributeValue("", 624, ViewData["currentFilter"], 624, 26, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(651, 117, true);
                WriteLiteral(" />\r\n                        <input type=\"submit\" value=\"Search\" class=\"btn btn-primary\" />\r\n                        ");
                EndContext();
                BeginContext(768, 44, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d16517", async() => {
                    BeginContext(790, 18, true);
                    WriteLiteral(" Back to full list");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(812, 64, true);
                WriteLiteral("\r\n                    </p>\r\n                </div>\r\n            ");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(883, 268, true);
            WriteLiteral(@"
        </div>
    </div>
    <div class=""row"">
        <div class=""col-md-12"">
            <table class=""table table-responsive table-hover"">
                <thead>
                    <tr>
                        <td>Team</td>
                        <td>");
            EndContext();
            BeginContext(1152, 121, false);
#line 36 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("Player", "Index", new { sortParam = ViewData["playerSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(1273, 74, true);
            WriteLiteral(" </td>\r\n                        <td>Pos</td>\r\n                        <td>");
            EndContext();
            BeginContext(1348, 114, false);
#line 38 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("FG%", "Index", new { sortParam = ViewData["fgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(1462, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(1499, 114, false);
#line 39 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("FT%", "Index", new { sortParam = ViewData["ftSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(1613, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(1650, 115, false);
#line 40 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("3PT", "Index", new { sortParam = ViewData["3ptSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(1765, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(1802, 115, false);
#line 41 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("PPG", "Index", new { sortParam = ViewData["ppgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(1917, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(1954, 115, false);
#line 42 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("APG", "Index", new { sortParam = ViewData["apgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(2069, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(2106, 115, false);
#line 43 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("RPG", "Index", new { sortParam = ViewData["rpgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(2221, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(2258, 115, false);
#line 44 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("SPG", "Index", new { sortParam = ViewData["spgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(2373, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(2410, 115, false);
#line 45 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("BPG", "Index", new { sortParam = ViewData["bpgSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(2525, 36, true);
            WriteLiteral(" </td>\r\n                        <td>");
            EndContext();
            BeginContext(2562, 113, false);
#line 46 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            Write(Html.ActionLink("TO", "Index", new { sortParam = ViewData["toSort"], currentFilter = ViewData["currentFilter"] }));

#line default
#line hidden
            EndContext();
            BeginContext(2675, 121, true);
            WriteLiteral(" </td>\r\n                        <td></td>\r\n                    </tr>\r\n                </thead>\r\n                <tbody>\r\n");
            EndContext();
#line 51 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            foreach (var p in Model)
            {
#line default
#line hidden
                BeginContext(2866, 58, true);
                WriteLiteral("                    <tr>\r\n                        <td><img");
                EndContext();
                BeginWriteAttribute("src", " src=\"", 2924, "\"", 2957, 1);
#line 54 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                WriteAttributeValue("", 2930, p.TeamNav.WikipediaLogoUrl, 2930, 27, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(2958, 55, true);
                WriteLiteral(" class=\"teamLogo\" /></td>\r\n                        <td>");
                EndContext();
                BeginContext(3014, 64, false);
#line 55 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.ActionLink(@p.FullName, "Details", new { id = p.PlayerID }));

#line default
#line hidden
                EndContext();
                BeginContext(3078, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3114, 32, false);
#line 56 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.Position));

#line default
#line hidden
                EndContext();
                BeginContext(3146, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3182, 53, false);
#line 57 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.FieldGoalsPercentage));

#line default
#line hidden
                EndContext();
                BeginContext(3235, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3271, 53, false);
#line 58 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.FreeThrowsPercentage));

#line default
#line hidden
                EndContext();
                BeginContext(3324, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3360, 50, false);
#line 59 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.ThreePointersMade));

#line default
#line hidden
                EndContext();
                BeginContext(3410, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3446, 36, false);
#line 60 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.PPG));

#line default
#line hidden
                EndContext();
                BeginContext(3482, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3518, 36, false);
#line 61 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.APG));

#line default
#line hidden
                EndContext();
                BeginContext(3554, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3590, 36, false);
#line 62 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.RPG));

#line default
#line hidden
                EndContext();
                BeginContext(3626, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3662, 36, false);
#line 63 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.SPG));

#line default
#line hidden
                EndContext();
                BeginContext(3698, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3734, 36, false);
#line 64 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.BPG));

#line default
#line hidden
                EndContext();
                BeginContext(3770, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(3806, 36, false);
#line 65 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                Write(Html.DisplayFor(m => p.StatsNav.TPG));

#line default
#line hidden
                EndContext();
                BeginContext(3842, 65, true);
                WriteLiteral("</td>\r\n                        <td>\r\n                            ");
                EndContext();
                BeginContext(3907, 62, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d120176", async() => {
                    BeginContext(3958, 7, true);
                    WriteLiteral("Details");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_2.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
                if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                {
                    throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                }
                BeginWriteTagHelperAttribute();
#line 67 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                WriteLiteral(p.PlayerID);

#line default
#line hidden
                __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(3969, 4, true);
                WriteLiteral(" |\r\n");
                EndContext();
#line 68 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                if ((await AuthorizationService.AuthorizeAsync(User, "AdminOnly")).Succeeded)
                {
#line default
#line hidden
                    BeginContext(4112, 32, true);
                    WriteLiteral("                                ");
                    EndContext();
                    BeginContext(4144, 60, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d122929", async() => {
                        BeginContext(4194, 6, true);
                        WriteLiteral("Delete");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
                    if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                    {
                        throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                    }
                    BeginWriteTagHelperAttribute();
#line 70 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                    WriteLiteral(p.PlayerID);

#line default
#line hidden
                    __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                    __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(4204, 2, true);
                    WriteLiteral("\r\n");
                    EndContext();
#line 71 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(4237, 58, true);
                WriteLiteral("                        </td>\r\n                    </tr>\r\n");
                EndContext();
#line 74 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(4318, 131, true);
            WriteLiteral("                </tbody>\r\n            </table>\r\n        </div>\r\n    </div>\r\n    <div class=\"row\">\r\n        <div class=\"col-md-6\">\r\n");
            EndContext();
#line 81 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"

            var prevDisabled = !Model.HasPreviousPage ? "disabled" : "";
            var nextDisabled = !Model.HasNextPage ? "disabled" : "";


#line default
#line hidden
            BeginContext(4632, 12, true);
            WriteLiteral("            ");
            EndContext();
            BeginContext(4644, 234, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d126426", async() => {
                BeginContext(4866, 8, true);
                WriteLiteral("Previous");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-sortParam", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 85 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(ViewData["currentSort"]);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["sortParam"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-sortParam", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["sortParam"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginWriteTagHelperAttribute();
#line 85 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(Model.PageIndex - 1);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["pageNumber"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-pageNumber", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["pageNumber"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginWriteTagHelperAttribute();
#line 86 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(ViewData["currentFilter"]);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["currentFilter"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-currentFilter", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["currentFilter"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            AddHtmlAttributeValue("", 4835, "btn", 4835, 3, true);
            AddHtmlAttributeValue(" ", 4838, "btn-primary", 4839, 12, true);
#line 86 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            AddHtmlAttributeValue(" ", 4850, prevDisabled, 4851, 13, false);

#line default
#line hidden
            EndAddHtmlAttributeValues(__tagHelperExecutionContext);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(4878, 14, true);
            WriteLiteral("\r\n            ");
            EndContext();
            BeginContext(4892, 230, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9f5d96b2acf7a83f2edd5ce5f058522293b5f2d130853", async() => {
                BeginContext(5114, 4, true);
                WriteLiteral("Next");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-sortParam", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 87 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(ViewData["currentSort"]);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["sortParam"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-sortParam", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["sortParam"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginWriteTagHelperAttribute();
#line 87 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(Model.PageIndex + 1);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["pageNumber"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-pageNumber", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["pageNumber"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginWriteTagHelperAttribute();
#line 88 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            WriteLiteral(ViewData["currentFilter"]);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["currentFilter"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-currentFilter", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["currentFilter"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            AddHtmlAttributeValue("", 5083, "btn", 5083, 3, true);
            AddHtmlAttributeValue(" ", 5086, "btn-primary", 5087, 12, true);
#line 88 "C:\Users\kebell\source\repos\dotnet_basketball\NBAMvc1.1\Views\Players\Index.cshtml"
            AddHtmlAttributeValue(" ", 5098, nextDisabled, 5099, 13, false);

#line default
#line hidden
            EndAddHtmlAttributeValues(__tagHelperExecutionContext);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(5122, 38, true);
            WriteLiteral("\r\n        </div>\r\n    </div>\r\n</div>\r\n");
            EndContext();
        }
Exemplo n.º 16
0
 public HomeController(IMediator mediator, AuthorizationService authorizationService)
 {
     this.mediator = mediator;
     this.authorizationService = authorizationService;
 }
 public MarkAsInterimController(AuthorizationService authorizationService, IMediator mediator)
 {
     this.authorizationService = authorizationService;
     this.mediator = mediator;
 }
Exemplo n.º 18
0
 public HomeController(NPMManagerService npmManagerService, IAssetsService assetsService, AuthorizationService authorizationService)
 {
     this.npmManagerService    = npmManagerService;
     this.assetsService        = assetsService;
     this.authorizationService = authorizationService;
 }
 public void Init()
 {
     authService = new TokenAuthorizationService();
 }
Exemplo n.º 20
0
 public AuthorizationScenarioInstance(AuthorizationScenario scenario, AuthorizationService authorizationService, IDictionary <string, string> resourceBindings)
 {
     this.scenario = scenario;
     init(authorizationService, resourceBindings);
 }
Exemplo n.º 21
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(44, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 3 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"

            ViewData["Title"] = "Index";

#line default
#line hidden
            BeginContext(83, 17, true);
            WriteLiteral("\n<h2>Index</h2>\n\n");
            EndContext();
            BeginContext(100, 361, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "41441c2d75c8464ab6388e7b06ed7c8d", async() => {
                BeginContext(138, 120, true);
                WriteLiteral("\n    <div class=\"form-actions no-color\">\n        <p>\n            Find by creator: <input type=\"text\" name=\"SearchString\"");
                EndContext();
                BeginWriteAttribute("value", " value=\"", 258, "\"", 292, 1);
#line 12 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                WriteAttributeValue("", 266, ViewData["CurrentFilter"], 266, 26, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(293, 93, true);
                WriteLiteral(" />\n            <input type=\"submit\" value=\"Search\" class=\"btn btn-default\" /> |\n            ");
                EndContext();
                BeginContext(386, 43, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "ff7fadc50eaf40e280d2e916a8a028b7", async() => {
                    BeginContext(408, 17, true);
                    WriteLiteral("Back to Full List");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(429, 25, true);
                WriteLiteral("\n        </p>\n    </div>\n");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(461, 140, true);
            WriteLiteral("\n<table class=\"table\">\n    <thead>\n        <tr>\n            <th>\n                Picture\n            </th>\n            <th>\n                ");
            EndContext();
            BeginContext(602, 43, false);
#line 25 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
            Write(Html.DisplayNameFor(model => model.Comment));

#line default
#line hidden
            EndContext();
            BeginContext(645, 145, true);
            WriteLiteral("\n            </th>\n\n            <th>\n                Uploaded by:\n            </th>\n            <th></th>\n        </tr>\n    </thead>\n    <tbody>\n");
            EndContext();
#line 35 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
            foreach (var item in Model)
            {
#line default
#line hidden
                BeginContext(837, 59, true);
                WriteLiteral("            <tr>\n                <td>\n\n                <img");
                EndContext();
                BeginWriteAttribute("src", " src=\"", 896, "\"", 917, 1);
#line 40 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                WriteAttributeValue("", 902, item.ImagePath, 902, 15, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(918, 119, true);
                WriteLiteral(" style=\"max-width:600px;width:100%\" />\n                </td>\n                \n                <td>\n                    ");
                EndContext();
                BeginContext(1038, 42, false);
#line 44 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Comment));

#line default
#line hidden
                EndContext();
                BeginContext(1080, 80, true);
                WriteLiteral("\n                </td>\n               \n                <td>\n                    ");
                EndContext();
                BeginContext(1161, 48, false);
#line 48 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.User.UserName));

#line default
#line hidden
                EndContext();
                BeginContext(1209, 44, true);
                WriteLiteral("\n                </td>\n                <td>\n");
                EndContext();
#line 51 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                if ((await AuthorizationService.AuthorizeAsync(
                         User, item,
                         CaffFileOperations.Update)).Succeeded)
                {
#line default
#line hidden
                    BeginContext(1435, 24, true);
                    WriteLiteral("                        ");
                    EndContext();
                    BeginContext(1459, 53, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "99fb989d41244b4ca5b414d988690cba", async() => {
                        BeginContext(1504, 4, true);
                        WriteLiteral("Edit");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_2.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
                    if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                    {
                        throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                    }
                    BeginWriteTagHelperAttribute();
#line 55 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                    WriteLiteral(item.Id);

#line default
#line hidden
                    __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                    __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(1512, 1, true);
                    WriteLiteral("\n");
                    EndContext();
                    BeginContext(1543, 3, true);
                    WriteLiteral(" | ");
                    EndContext();
#line 56 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(1576, 20, true);
                WriteLiteral("                    ");
                EndContext();
#line 58 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                if ((await AuthorizationService.AuthorizeAsync(
                         User, item,
                         CaffFileOperations.Delete)).Succeeded)
                {
#line default
#line hidden
                    BeginContext(1760, 24, true);
                    WriteLiteral("                        ");
                    EndContext();
                    BeginContext(1784, 57, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c46c6809dd8f49559ac41d4c70a01c06", async() => {
                        BeginContext(1831, 6, true);
                        WriteLiteral("Delete");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
                    if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                    {
                        throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                    }
                    BeginWriteTagHelperAttribute();
#line 62 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                    WriteLiteral(item.Id);

#line default
#line hidden
                    __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                    __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(1841, 1, true);
                    WriteLiteral("\n");
                    EndContext();
#line 63 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(1864, 57, true);
                WriteLiteral("                    <text> | </text>\n                    ");
                EndContext();
                BeginContext(1921, 61, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "f694a7e9eeb64746a1c747d73d5da8d8", async() => {
                    BeginContext(1970, 8, true);
                    WriteLiteral("Download");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_4.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
                if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                {
                    throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                }
                BeginWriteTagHelperAttribute();
#line 65 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
                WriteLiteral(item.Id);

#line default
#line hidden
                __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1982, 41, true);
                WriteLiteral("\n                </td>\n            </tr>\n");
                EndContext();
#line 68 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(2033, 22, true);
            WriteLiteral("    </tbody>\n</table>\n");
            EndContext();
        }
Exemplo n.º 22
0
        public bool IsCurrentUserAllowedToExecuteCommandInCurrentState(ServiceIdentity identity, WorkflowState state, Guid instanceId)
        {
            if (state == null)
            {
                return(ValidateInitiator(identity, instanceId));
            }

            if (state.Type != WorkflowType.DemandWorkflow)
            {
                return(false);
            }

            if (state == WorkflowState.DemandDraft)
            {
                return(ValidateInitiator(identity, instanceId));
            }

            if (state == WorkflowState.DemandUPKZCuratorSighting)
            {
                return(AuthorizationService.IsInRole(identity.Id, BudgetRole.Curator));
            }

            if (state == WorkflowState.DemandRollbackRequested)
            {
                return(AuthorizationService.IsInRole(identity.Id, BudgetRole.Curator));
            }

            if (state == WorkflowState.DemandUPKZHeadSighting)
            {
                return(AuthorizationService.IsInRole(identity.Id, BudgetRole.UPKZHead));
            }

            if (state == WorkflowState.DemandOPExpertSighting)
            {
                return(AuthorizationService.IsInRole(identity.Id, BudgetRole.Expert) && ValidateCurrentUserInOP(identity, instanceId));
            }

            if (state == WorkflowState.DemandOPHeadSighting)
            {
                return(AuthorizationService.IsInRole(identity.Id, BudgetRole.DivisionHead) && ValidateCurrentUserInOP(identity, instanceId));
            }

            if (state == WorkflowState.DemandAgreementOPExpertSighting)
            {
                //http://pmtask.ru/redmine/issues/867
                //return AuthorizationService.IsInRole(identity.Id, BudgetRole.Expert) && ValidateCurrentUserInAgreementOP(identity, instanceId);
                return(ValidateCurrentUserInAgreementOP(identity, instanceId));
            }

            //if (state == WorkflowState.DemandAgreementOPHeadSighting)
            //    return AuthorizationService.IsInRole(identity.Id, BudgetRole.DivisionHead) && ValidateCurrentUserInAgreementOP(identity, instanceId);

            if (state == WorkflowState.DemandInitiatorHeadSighting /*|| state == WorkflowState.DemandAgreementInitiatorHeadSighting*/)
            {
                return(ValidateInitiatorHead(identity, instanceId));
            }



            return(false);
        }
Exemplo n.º 23
0
        public HttpResponseMessage CreateNote([FromUri] int id)
        {
            var                  response     = new HttpResponseMessage();
            ResponseFormat       responseData = new ResponseFormat();
            IEnumerable <string> headerValues;

            if (Request.Headers.TryGetValues("Authorization", out headerValues))
            {
                string jwt = headerValues.FirstOrDefault();
                AuthorizationService _authorizationService = new AuthorizationService().SetPerm((int)EnumPermissions.NOTE_CREATE);
                //validate jwt
                var payload = JwtTokenManager.ValidateJwtToken(jwt);

                if (payload.ContainsKey("error"))
                {
                    if ((string)payload["error"] == ErrorMessages.TOKEN_EXPIRED)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_EXPIRED;
                    }
                    if ((string)payload["error"] == ErrorMessages.TOKEN_INVALID)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_INVALID;
                    }
                }
                else
                {
                    var userId       = Convert.ToInt32(payload["id"]);
                    var isAuthorized = _authorizationService.Authorize(userId);
                    if (isAuthorized)
                    {
                        string noteBody = HttpContext.Current.Request.Form["body"];
                        if (!string.IsNullOrEmpty(noteBody))
                        {
                            //create a note
                            NoteApiModel apiModel = new NoteApiModel();
                            apiModel.body      = noteBody;
                            apiModel.createdBy = new UserLinkApiModel()
                            {
                                id = userId
                            };

                            var templateId = _taskTemplateService.GetTaskTemplateId(id);
                            apiModel.taskTemplate = templateId;
                            var createdNote = _noteService.Create(apiModel);

                            //create files and link them to note
                            if (HttpContext.Current.Request.Files.Count > 0)
                            {
                                var allFiles = HttpContext.Current.Request.Files;
                                foreach (string fileName in allFiles)
                                {
                                    HttpPostedFile   uploadedFile = allFiles[fileName];
                                    FileManager.File file         = new FileManager.File(uploadedFile);
                                    _noteService.AddFile(createdNote, file);
                                }
                            }
                            response.StatusCode  = HttpStatusCode.OK;
                            responseData         = ResponseFormat.Success;
                            responseData.message = SuccessMessages.NOTE_ADDED;
                        }
                        else
                        {
                            response.StatusCode  = HttpStatusCode.BadRequest;
                            responseData         = ResponseFormat.Fail;
                            responseData.message = ErrorMessages.NOTE_EMPTY;
                        }
                    }
                    else
                    {
                        response.StatusCode  = HttpStatusCode.Forbidden;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.UNAUTHORIZED;
                    }
                }
            }
            else
            {
                response.StatusCode  = HttpStatusCode.Unauthorized;
                responseData         = ResponseFormat.Fail;
                responseData.message = ErrorMessages.UNAUTHORIZED;
            }
            var json = JsonConvert.SerializeObject(responseData);

            response.Content = new StringContent(json, Encoding.UTF8, "application/json");
            return(response);
        }
Exemplo n.º 24
0
 protected IAuthorizationService GetSecurityService()
 {
     AuthorizationService service = new AuthorizationService(PermissionRepository);
     return service;
 }
Exemplo n.º 25
0
        public HttpResponseMessage Delete([FromUri] int id)
        {
            var                  response              = new HttpResponseMessage();
            ResponseFormat       responseData          = new ResponseFormat();
            AuthorizationService _authorizationService = new AuthorizationService().SetPerm((int)EnumPermissions.ACCOUNT_DELETE);
            IEnumerable <string> headerValues;

            if (Request.Headers.TryGetValues("Authorization", out headerValues))
            {
                string jwt = headerValues.FirstOrDefault();
                //validate jwt
                var payload = JwtTokenManager.ValidateJwtToken(jwt);

                if (payload.ContainsKey("error"))
                {
                    if ((string)payload["error"] == ErrorMessages.TOKEN_EXPIRED)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_EXPIRED;
                    }
                    if ((string)payload["error"] == ErrorMessages.TOKEN_INVALID)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_INVALID;
                    }
                }
                else
                {
                    var userId = payload["id"];

                    var isAuthorized = _authorizationService.Authorize(Convert.ToInt32(userId));
                    if (isAuthorized)
                    {
                        var isDeleted = _accountService.Delete(id);
                        if (isDeleted)
                        {
                            response.StatusCode  = HttpStatusCode.OK;
                            responseData         = ResponseFormat.Success;
                            responseData.message = SuccessMessages.ACCOUNT_DELETED;
                        }
                        else
                        {
                            response.StatusCode  = HttpStatusCode.InternalServerError;
                            responseData         = ResponseFormat.Fail;
                            responseData.message = ErrorMessages.SOMETHING_WRONG;
                        }
                    }
                    else
                    {
                        response.StatusCode  = HttpStatusCode.Forbidden;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.UNAUTHORIZED;
                    }
                }
            }
            else
            {
                response.StatusCode  = HttpStatusCode.Unauthorized;
                responseData         = ResponseFormat.Fail;
                responseData.message = ErrorMessages.UNAUTHORIZED;
            }
            var json = JsonConvert.SerializeObject(responseData);

            response.Content = new StringContent(json, Encoding.UTF8, "application/json");
            return(response);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 验证昵称是否可用
        /// </summary>
        /// <param name="nickName">被验证的昵称</param>
        /// <param name="errorMessage">错误信息</param>
        /// <returns></returns>
        public static bool ValidateNickName(string nickName, out string errorMessage, long?userId = null)
        {
            if (string.IsNullOrEmpty(nickName))
            {
                errorMessage = ResourceAccessor.GetString("Validate_NickNameRequired");
                return(false);
            }
            ISettingsManager <UserSettings> userSettingsManager = DIContainer.Resolve <ISettingsManager <UserSettings> >();
            UserSettings userSettings = userSettingsManager.Get();

            if (nickName.Contains("*"))
            {
                errorMessage = string.Format(ResourceAccessor.GetString("Validate_NickNameHasSensitiveWord"));;
                return(false);
            }

            if (nickName.Length < userSettings.MinUserNameLength)
            {
                errorMessage = string.Format(ResourceAccessor.GetString("Validate_NickNameTooShort"), userSettings.MinUserNameLength);
                return(false);
            }

            if (nickName.Length > userSettings.MaxUserNameLength)
            {
                errorMessage = string.Format(ResourceAccessor.GetString("Validate_NickNameTooLong"), userSettings.MaxUserNameLength);
                return(false);
            }

            Regex regex = new Regex(userSettings.NickNameRegex);

            if (!regex.IsMatch(nickName))
            {
                errorMessage = ResourceAccessor.GetString("Validate_NickNameRegex");
                return(false);
            }

            AuthorizationService authorizationService = new AuthorizationService();

            if (!authorizationService.IsSuperAdministrator(UserContext.CurrentUser) &&
                userSettings.DisallowedUserNames.Split(',', ',').Any(n => n.Equals(nickName, StringComparison.CurrentCultureIgnoreCase)))
            {
                errorMessage = ResourceAccessor.GetString("Validate_NickNameIsDisallowed");
                return(false);
            }


            //验证nickName是否已经存在
            IUserService userService = DIContainer.Resolve <IUserService>();
            IUser        user        = userService.GetUserByNickName(nickName);

            if (user != null)
            {
                if (userId.HasValue)
                {
                    if (user.UserId == userId.Value)
                    {
                        errorMessage = string.Empty;
                        return(true);
                    }
                }
                errorMessage = ResourceAccessor.GetString("Validate_NickNameIsExisting");
                return(false);
            }
            errorMessage = string.Empty;
            return(true);
        }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(44, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 3 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
  
    ViewData["Title"] = "List";

#line default
#line hidden
            BeginContext(82, 155, true);
            WriteLiteral("\n<h2>List</h2>\n\n<table class=\"table\">\n    <thead>\n        <tr>\n            <th>\n                Picture\n            </th>\n            <th>\n                ");
            EndContext();
            BeginContext(238, 43, false);
#line 16 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
           Write(Html.DisplayNameFor(model => model.Comment));

#line default
#line hidden
            EndContext();
            BeginContext(281, 81, true);
            WriteLiteral("\n            </th>\n\n            <th></th>\n        </tr>\n    </thead>\n    <tbody>\n");
            EndContext();
#line 23 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
 foreach (var item in Model) {

#line default
#line hidden
            BeginContext(393, 50, true);
            WriteLiteral("        <tr>\n            <td>\n                <img");
            EndContext();
            BeginWriteAttribute("src", " src=\"", 443, "\"", 464, 1);
#line 26 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
WriteAttributeValue("", 449, item.ImagePath, 449, 15, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(465, 91, true);
            WriteLiteral(" style=\"max-width:600px;width:100%\" />\n            </td>\n\n            <td>\n                ");
            EndContext();
            BeginContext(557, 42, false);
#line 30 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
           Write(Html.DisplayFor(modelItem => item.Comment));

#line default
#line hidden
            EndContext();
            BeginContext(599, 49, true);
            WriteLiteral("\n            </td>\n            \n            <td>\n");
            EndContext();
#line 34 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                 if ((await AuthorizationService.AuthorizeAsync(
              User, item,
              CaffFileOperations.Update)).Succeeded)
                {

#line default
#line hidden
            BeginContext(810, 20, true);
            WriteLiteral("                    ");
            EndContext();
            BeginContext(830, 53, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "426cdaf1d4ae4e61ba723695e3040d2c", async() => {
                BeginContext(875, 4, true);
                WriteLiteral("Edit");
                EndContext();
            }
            );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 38 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                                           WriteLiteral(item.Id);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(883, 1, true);
            WriteLiteral("\n");
            EndContext();
            BeginContext(910, 3, true);
            WriteLiteral(" | ");
            EndContext();
#line 39 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                                    
                }

#line default
#line hidden
            BeginContext(939, 16, true);
            WriteLiteral("                ");
            EndContext();
#line 41 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                 if ((await AuthorizationService.AuthorizeAsync(
               User, item,
               CaffFileOperations.Delete)).Succeeded)
                {

#line default
#line hidden
            BeginContext(1103, 20, true);
            WriteLiteral("                    ");
            EndContext();
            BeginContext(1123, 57, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "a01596f3e3b6433b949d3377333321f4", async() => {
                BeginContext(1170, 6, true);
                WriteLiteral("Delete");
                EndContext();
            }
            );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 45 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                                             WriteLiteral(item.Id);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1180, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 46 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                }

#line default
#line hidden
            BeginContext(1199, 49, true);
            WriteLiteral("                <text> | </text>\n                ");
            EndContext();
            BeginContext(1248, 61, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "1c29e901ae714fca9e763d8ddd8eb0cd", async() => {
                BeginContext(1297, 8, true);
                WriteLiteral("Download");
                EndContext();
            }
            );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_2.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 48 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
                                           WriteLiteral(item.Id);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1309, 34, true);
            WriteLiteral("\n\n            </td>\n        </tr>\n");
            EndContext();
#line 52 "C:\Users\playm\Desktop\MSc\szamitogep_biztonsag\new\szamitogep_biztonsag-barmilehet-akos\Webshop\Views\CaffFile\List.cshtml"
}

#line default
#line hidden
            BeginContext(1345, 22, true);
            WriteLiteral("    </tbody>\n</table>\n");
            EndContext();
        }
Exemplo n.º 28
0
        private void FilterEnvironments(IEnvironmentModel connection, bool clearSelections = true)
        {
            if (connection != null)
            {
                if (Application.Current != null && Application.Current.Dispatcher != null)
                {
                    Application.Current.Dispatcher.Invoke(() => ExplorerItemModels.Clear());
                }
                else
                {
                    ExplorerItemModels.Clear();
                }

                var isAuthorizedDeployTo = AuthorizationService != null && AuthorizationService.IsAuthorized(AuthorizationContext.DeployTo, Guid.Empty.ToString());
                if (isAuthorizedDeployTo && _target)
                {
                    ObservableCollection <IExplorerItemModel> explorerItemModels = new ObservableCollection <IExplorerItemModel>
                    {
                        StudioResourceRepository.FindItem(env => env.EnvironmentId == connection.ID)
                    };

                    ExplorerItemModels = explorerItemModels;

                    if (ExplorerItemModels != null && ExplorerItemModels.Count == 1 && ExplorerItemModels[0] != null)
                    {
                        ExplorerItemModels[0].IsDeployTargetExpanded = true;
                    }
                }
                else
                {
                    var isAuthorizedDeployFrom = AuthorizationService != null && AuthorizationService.IsAuthorized(AuthorizationContext.DeployFrom, Guid.Empty.ToString());
                    if (isAuthorizedDeployFrom && !_target)
                    {
                        var explorerItemModels = new ObservableCollection <IExplorerItemModel>
                        {
                            StudioResourceRepository.FindItem(env => env.EnvironmentId == connection.ID)
                        };

                        ExplorerItemModels = explorerItemModels;

                        if (ExplorerItemModels != null && ExplorerItemModels.Count == 1 && ExplorerItemModels[0] != null)
                        {
                            ExplorerItemModels[0].IsDeploySourceExpanded = true;
                        }
                    }
                    else
                    {
                        var model = StudioResourceRepository.Filter(env => env.EnvironmentId == connection.ID);
                        if (model != null)
                        {
                            if (model.Count == 1)
                            {
                                StudioResourceRepository.PerformUpdateOnDispatcher(() => model[0].Children = new ObservableCollection <IExplorerItemModel>());
                                if (AuthorizationService != null)
                                {
                                    var resourcePermissions = AuthorizationService.GetResourcePermissions(Guid.Empty);
                                    model[0].Permissions = resourcePermissions;
                                }
                            }
                            ExplorerItemModels = model;
                        }
                    }
                }
                if (clearSelections)
                {
                    Iterate(model => model.IsChecked   = false);
                    Iterate(model => model.IsOverwrite = false);
                }
            }
        }
Exemplo n.º 29
0
        private async Task TryPurgeInviteLinkAsync(IMessage message)
        {
            if
            (
                !(message.Author is IGuildUser author) || (author.Guild is null) ||
                !(message.Channel is IGuildChannel channel) || (channel.Guild is null)
            )
            {
                Log.Debug("Message {MessageId} was not in an IGuildChannel & IMessageChannel, or Author {Author} was not an IGuildUser",
                          message.Id, message.Author.Id);
                return;
            }

            if (author.Id == _discordSocketClient.CurrentUser.Id)
            {
                return;
            }

            var matches = _inviteLinkMatcher.Matches(message.Content);

            if (!matches.Any())
            {
                return;
            }

            if (await DesignatedChannelService.ChannelHasDesignationAsync(channel.Guild, channel, DesignatedChannelType.Unmoderated, default))
            {
                return;
            }

            if (await AuthorizationService.HasClaimsAsync(author, AuthorizationClaim.PostInviteLink))
            {
                Log.Debug("Message {MessageId} was skipped because the author {Author} has the PostInviteLink claim",
                          message.Id, message.Author.Id);
                return;
            }

            var invites = new List <IInvite>(matches.Count);

            foreach (var code in matches.Select(x => x.Groups["Code"].Value))
            {
                var invite = await _discordSocketClient.GetInviteAsync(code);

                invites.Add(invite);
            }

            // Allow invites to the guild in which the message was posted
            if (invites.All(x => x?.GuildId == author.GuildId))
            {
                Log.Debug("Message {MessageId} was skipped because the invite was to this server", message.Id);
                return;
            }

            Log.Debug("Message {MessageId} is going to be deleted", message.Id);

            await ModerationService.DeleteMessageAsync(message, "Unauthorized Invite Link", _discordSocketClient.CurrentUser.Id, default);

            Log.Debug("Message {MessageId} was deleted because it contains an invite link", message.Id);

            await message.Channel.SendMessageAsync($"Sorry {author.Mention} your invite link has been removed - please don't post links to other guilds");
        }
Exemplo n.º 30
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var    authentication = HttpContext.Current.GetOwinContext().Authentication;
            var    ticket         = authentication.AuthenticateAsync(DefaultAuthenticationTypes.ApplicationCookie).Result;
            var    identity       = ticket != null ? ticket.Identity : null;
            string userName       = null;

            string[] authorizedScopes = null;
            var      scopes           = (Request.QueryString.Get("scope") ?? "").Split(' ');
            bool     scopesApproved   = false;

            if (identity == null)
            {
                authentication.Challenge(DefaultAuthenticationTypes.ApplicationCookie);
                Response.Redirect(OAuthSettings["OAuthLoginPath"] + "?ReturnUrl=" + Server.UrlEncode(Request.RawUrl), true);
            }
            else if (CurrentUser == null)
            {
                // Kill the OAuth session
                authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
                authentication.Challenge(DefaultAuthenticationTypes.ApplicationCookie);
                Response.Redirect(OAuthSettings["OAuthLoginPath"] + "?ReturnUrl=" + Server.UrlEncode(Request.RawUrl), true);
            }
            else
            {
                OAuthContext  context       = new OAuthContext();
                ClientService clientService = new ClientService(context);
                Client        OAuthClient   = clientService.GetByApiKey(PageParameter("client_id").AsGuid());
                if (OAuthClient != null)
                {
                    ClientScopeService clientScopeService = new ClientScopeService(context);

                    userName = identity.Name;
                    AuthorizationService authorizationService = new AuthorizationService(context);

                    authorizedScopes = authorizationService.Queryable().Where(a => a.Client.Id == OAuthClient.Id && a.UserLogin.UserName == identity.Name && a.Active == true).Select(a => a.Scope.Identifier).ToArray <string>();
                    if (!clientScopeService.Queryable().Where(cs => cs.ClientId == OAuthClient.Id && cs.Active == true).Any() ||
                        (authorizedScopes != null && scopes.Where(s => !authorizedScopes.Select(a => a.ToLower()).Contains(s.ToLower())).Count() == 0))
                    {
                        scopesApproved = true;
                    }

                    if (scopesApproved)
                    {
                        identity = new ClaimsIdentity(identity.Claims, "Bearer", identity.NameClaimType, identity.RoleClaimType);

                        //only allow claims that have been requested and the client has been authorized for
                        foreach (var scope in scopes.Where(s => clientScopeService.Queryable().Where(cs => cs.ClientId == OAuthClient.Id && cs.Active == true).Select(cs => cs.Scope.Identifier.ToLower()).Contains(s.ToLower())))
                        {
                            identity.AddClaim(new Claim("urn:oauth:scope", scope));
                        }
                        authentication.SignIn(identity);
                    }
                    else
                    {
                        rptScopes.DataSource = clientScopeService.Queryable().Where(cs => cs.ClientId == OAuthClient.Id && cs.Active == true).Select(s => s.Scope).ToList();
                        rptScopes.DataBind();
                    }

                    lClientName.Text     = OAuthClient.ClientName;
                    lClientName2.Text    = OAuthClient.ClientName;
                    lUsername.Text       = CurrentUser.Person.FullName + " (" + userName + ")";
                    hlLogout.NavigateUrl = Request.RawUrl + "&OAuthLogout=true";
                }
                else
                {
                    throw new Exception("Invalid Client ID for OAuth authentication.");
                }
            }
        }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(178, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 6 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"

            ViewData["Title"] = "Details";

#line default
#line hidden
            BeginContext(223, 124, true);
            WriteLiteral("\r\n<div class=\"container container-fluid bg-white\">\r\n    <div class=\"row\">\r\n        <div class=\"col-md-12\">\r\n            <h3>");
            EndContext();
            BeginContext(348, 17, false);
#line 13 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
            Write(Model.MyTeam.Name);

#line default
#line hidden
            EndContext();
            BeginContext(365, 23, true);
            WriteLiteral("</h3>\r\n            <h6>");
            EndContext();
            BeginContext(389, 26, false);
#line 14 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
            Write(Model.MyTeam.UserNav.Email);

#line default
#line hidden
            EndContext();
            BeginContext(415, 23, true);
            WriteLiteral("</h6>\r\n            <h6>");
            EndContext();
            BeginContext(438, 140, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5e936820c4db52b52bdbbead9e2f25e029f77d4d6334", async() => {
                BeginContext(540, 34, false);
#line 15 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(Model.MyTeam.FantasyLeagueNav.Name);

#line default
#line hidden
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
            {
                throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
            }
            BeginWriteTagHelperAttribute();
#line 15 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
            WriteLiteral(Model.MyTeam.FantasyLeagueID);

#line default
#line hidden
            __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
            __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(578, 724, true);
            WriteLiteral(@"</h6>
        </div>
    </div>
    <div class=""row"">
        <div class=""col-md-12"">
            <table class=""table table-hover"">
                <thead>
                    <tr>
                        <th>Pos</th>
                        <th>Name</th>
                        <th>Team</th>
                        <td>FG%</td>
                        <td>FT%</td>
                        <td>3PT</td>
                        <td>PTS</td>
                        <td>AST</td>
                        <td>RBD</td>
                        <td>STL</td>
                        <td>BLK</td>
                        <td>TO</td>
                    </tr>
                </thead>
                <tbody>
");
            EndContext();
#line 38 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
            foreach (KeyValuePair <string, Player> entry in Model.Roster)
            {
#line default
#line hidden
                BeginContext(1408, 62, true);
                WriteLiteral("                    <tr>\r\n                        <td><strong>");
                EndContext();
                BeginContext(1471, 9, false);
#line 41 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Key);

#line default
#line hidden
                EndContext();
                BeginContext(1480, 44, true);
                WriteLiteral("</strong></td>\r\n                        <td>");
                EndContext();
                BeginContext(1526, 47, false);
#line 42 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.FullName : "");

#line default
#line hidden
                EndContext();
                BeginContext(1574, 40, true);
                WriteLiteral("</td>\r\n                        <td> <img");
                EndContext();
                BeginWriteAttribute("src", " src=\"", 1614, "\"", 1687, 1);
#line 43 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                WriteAttributeValue("", 1620, entry.Value != null ? entry.Value.TeamNav.WikipediaLogoUrl : "#", 1620, 67, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(1688, 85, true);
                WriteLiteral(" alt=\"Add a player s******d\" class=\"teamLogoSM\" /></td>\r\n                        <td>");
                EndContext();
                BeginContext(1775, 67, false);
#line 44 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.FieldGoalsPercentage : 0);

#line default
#line hidden
                EndContext();
                BeginContext(1843, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(1880, 67, false);
#line 45 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.FreeThrowsPercentage : 0);

#line default
#line hidden
                EndContext();
                BeginContext(1948, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(1985, 64, false);
#line 46 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.ThreePointersMade : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2050, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2087, 50, false);
#line 47 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.PPG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2138, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2175, 50, false);
#line 48 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.APG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2226, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2263, 50, false);
#line 49 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.RPG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2314, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2351, 50, false);
#line 50 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.SPG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2402, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2439, 50, false);
#line 51 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.BPG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2490, 35, true);
                WriteLiteral("</td>\r\n                        <td>");
                EndContext();
                BeginContext(2527, 50, false);
#line 52 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                Write(entry.Value != null ? entry.Value.StatsNav.TPG : 0);

#line default
#line hidden
                EndContext();
                BeginContext(2578, 7, true);
                WriteLiteral("</td>\r\n");
                EndContext();
#line 53 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                if (entry.Value == null)
                {
#line default
#line hidden
#line 55 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                    if ((await AuthorizationService.AuthorizeAsync(User, Model.MyTeam, Operations.Read)).Succeeded)
                    {
#line default
#line hidden
                        BeginContext(2820, 36, true);
                        WriteLiteral("                                <td>");
                        EndContext();
                        BeginContext(2856, 190, false);
                        __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5e936820c4db52b52bdbbead9e2f25e029f77d4d16212", async() => {
                            BeginContext(3039, 3, true);
                            WriteLiteral("Add");
                            EndContext();
                        }
                                                                                    );
                        __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                        __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                        __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_2.Value;
                        __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
                        __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value;
                        __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
                        if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                        {
                            throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-posFilter", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                        }
                        BeginWriteTagHelperAttribute();
#line 57 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                        WriteLiteral(entry.Key.TrimEnd("12".ToCharArray()));

#line default
#line hidden
                        __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                        __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["posFilter"] = __tagHelperStringValueBuffer;
                        __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-posFilter", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["posFilter"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                        BeginWriteTagHelperAttribute();
#line 57 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                        WriteLiteral(Model.MyTeam.MyTeamID);

#line default
#line hidden
                        __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                        __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["teamID"] = __tagHelperStringValueBuffer;
                        __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-teamID", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["teamID"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                        __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4);
                        await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                        if (!__tagHelperExecutionContext.Output.IsContentModified)
                        {
                            await __tagHelperExecutionContext.SetOutputContentAsync();
                        }
                        Write(__tagHelperExecutionContext.Output);
                        __tagHelperExecutionContext = __tagHelperScopeManager.End();
                        EndContext();
                        BeginContext(3046, 8, true);
                        WriteLiteral(" </td>\r\n");
                        EndContext();
#line 58 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                    }

#line default
#line hidden
#line 58 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                }
                else
                {
#line default
#line hidden
#line 62 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                    if ((await AuthorizationService.AuthorizeAsync(User, Model.MyTeam, Operations.Read)).Succeeded)
                    {
#line default
#line hidden
                        BeginContext(3326, 38, true);
                        WriteLiteral("                                <td>\r\n");
                        EndContext();
#line 65 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                        using (Html.BeginForm("Delete", "PlayerMyTeams"))
                        {
#line default
#line hidden
                            BeginContext(3532, 45, false);
#line 67 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                            Write(Html.Hidden("playerID", entry.Value.PlayerID));

#line default
#line hidden
                            EndContext();
                            BeginContext(3620, 46, false);
#line 68 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                            Write(Html.Hidden("myTeamID", Model.MyTeam.MyTeamID));

#line default
#line hidden
                            EndContext();
                            BeginContext(3668, 100, true);
                            WriteLiteral("                                        <input type=\"submit\" value=\"Cut\" class=\"btn btn-danger\" />\r\n");
                            EndContext();
#line 70 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                        }

#line default
#line hidden
                        BeginContext(3807, 39, true);
                        WriteLiteral("                                </td>\r\n");
                        EndContext();
#line 72 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                    }

#line default
#line hidden
#line 72 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
                }

#line default
#line hidden
                BeginContext(3904, 27, true);
                WriteLiteral("                    </tr>\r\n");
                EndContext();
#line 75 "C:\Users\kebell\Source\Repos\dotnet_basketball_2.0\NBAMvc1.1\Views\MyTeams\Details.cshtml"
            }

#line default
#line hidden
            BeginContext(3954, 84, true);
            WriteLiteral("                </tbody>\r\n            </table>\r\n        </div>\r\n    </div>\r\n</div>\r\n");
            EndContext();
        }
Exemplo n.º 32
0
        static void Main(string[] args)
        {
            long count = 1;
            IIdentityVerificationService ıdentityVerificationService = new IdentityVerificationService();
            IAuthorizationService        authorizationService        = new AuthorizationService();
            IUserService userService = new UserService();
            IGameService gameService = new GameService();

            //New gamer
            Gamer gamer = new Gamer {
                RegisterNumber = Guid.NewGuid().ToString().Substring(0, 10), Email = "*****@*****.**", Avatar = "~/Images/avatar.ico", FirstName = "ad", LastName = "soyad", CreationTime = DateTime.Now, Id = count, IsActive = true, IsEmailVerification = false, ModificationTime = null, NickName = "Gamer1", Password = "******", BirthYear = 1991, IdentityNumber = "1111111111", JoinCampaignCount = 0, MembershipDate = DateTime.Now
            };

            Game game = new Game {
                CurrencyId = 1, GameType = "Actin", Id = 1, IsAutomaticSale = false, Name = "LOTR", PosterUrl = "~/Images/lotr.png", ReleaseDate = DateTime.Now.Date, SalePrice = 299, Size = 10024
            };

            gameService.Create(game);

            // not> ad-soyad-doğum yılı ve kimlik numaranızı girerek bu aşamayı geçebilirsiniz. örnek verilerden dolayı false döner.
            if (gamer.IdentityNumber.Length == 11)
            {
                var returnIdentityControl = ıdentityVerificationService.TCQuery(gamer.FirstName, gamer.LastName, gamer.IdentityNumber, 1992);
                if (returnIdentityControl)//tc kimlik no doğrulandı
                {
                    var returnUserId = userService.CreateAndReturnUserId(gamer);
                    if (returnUserId > 0)
                    {
                        authorizationService.AddUserAuthorization(returnUserId, "BasicGamer"); //yetkilendirme veriyoruz.
                    }
                    Console.WriteLine("********************");
                    Console.WriteLine("1-)Sale\n2-ApplyCampaign)");
                    Console.WriteLine("************************");
                    int choice = Convert.ToInt32(Console.ReadLine());

                    if (choice == 1)
                    {
                        Console.WriteLine("Game " + game.Name + " sold for " + gamer.Email);
                    }
                    if (choice == 2)
                    {
                        Console.WriteLine("********************");
                        Console.WriteLine("1-)%10\n2-%20)");
                        Console.WriteLine("************************");
                        int choice2 = Convert.ToInt32(Console.ReadLine());
                        if (choice2 == 1)
                        {
                            var result = game.SalePrice - ((game.SalePrice * 10) / 100);
                            Console.WriteLine("%10 Discount applied for {0}", game.Name);
                            Console.WriteLine("Sale Amount {0}", result);
                        }
                        else if (choice2 == 2)
                        {
                            var result = game.SalePrice - ((game.SalePrice * 20) / 100);
                            Console.WriteLine("%20 Discount applied for {0}", game.Name);
                            Console.WriteLine("Sale Amount {0}", result);
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Your IdentityNumber could not be verified");
                }

                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("Your IdentityNumber length short or long than 11");
            }
        }
Exemplo n.º 33
0
        /// <inheritdoc />
        public async Task HandleNotificationAsync(MessageReceivedNotification notification, CancellationToken cancellationToken = default)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            if (!(notification.Message is IUserMessage userMessage) ||
                (userMessage.Author is null))
            {
                return;
            }

            if (!(userMessage.Author is IGuildUser author) ||
                (author.Guild is null) ||
                author.IsBot ||
                author.IsWebhook)
            {
                return;
            }

            var argPos = 0;

            if (!userMessage.HasCharPrefix('!', ref argPos) && !userMessage.HasMentionPrefix(DiscordClient.CurrentUser, ref argPos))
            {
                return;
            }

            if (userMessage.Content.Length <= 1)
            {
                return;
            }

            var commandContext = new CommandContext(DiscordClient, userMessage);

            await AuthorizationService.OnAuthenticatedAsync(author);

            var commandResult = await CommandService.ExecuteAsync(commandContext, argPos, ServiceProvider);

            if (!commandResult.IsSuccess)
            {
                var error = $"{commandResult.Error}: {commandResult.ErrorReason}";

                if (string.Equals(commandResult.ErrorReason, "UnknownCommand", StringComparison.OrdinalIgnoreCase))
                {
                    Log.Error(error);
                }
                else
                {
                    Log.Warning(error);
                }

                if (commandResult.Error == CommandError.Exception)
                {
                    await commandContext.Channel.SendMessageAsync($"Error: {FormatUtilities.SanitizeEveryone(commandResult.ErrorReason)}");
                }
                else
                {
                    await CommandErrorHandler.AssociateError(userMessage, error);
                }
            }

            stopwatch.Stop();
            Log.Information($"Command took {stopwatch.ElapsedMilliseconds}ms to process: {commandContext.Message}");
        }
 public AccountManagementController(IMediator mediator, AuthorizationService authorizationService)
 {
     this.mediator = mediator;
     this.authorizationService = authorizationService;
 }
Exemplo n.º 35
0
 public AuthController(AuthorizationService authService, ISessionService session)
 {
     _authService = authService;
     _session     = session;
 }
Exemplo n.º 36
0
 public RequestContextFilter(AuthorizationService authorizationService)
 {
     this.authorizationService = authorizationService;
 }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(95, 348, true);
            WriteLiteral(@"
<nav class=""navbar navbar-inverse"">
  <div class=""container-fluid"">
    <div class=""navbar-header"">
      <button type=""button"" class=""navbar-toggle"" data-toggle=""collapse"" data-target=""#myNavbar"">
        <span class=""icon-bar""></span>
        <span class=""icon-bar""></span>
        <span class=""icon-bar""></span> 
      </button>
      ");
            EndContext();
            BeginContext(443, 67, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5bc0fba653a748d0a72d3d741bc81148", async() => {
                BeginContext(496, 10, true);
                WriteLiteral("Formulário");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(510, 4, true);
            WriteLiteral("\r\n\r\n");
            EndContext();
#line 14 "/home/developer/SISGO/Apresentacao/src/Pages/Shared/_LoginPartial.cshtml"
            if ((await AuthorizationService.AuthorizeAsync(User, "RequireAdministratorRole")).Succeeded)
            {
#line default
#line hidden
                BeginContext(626, 12, true);
                WriteLiteral("            ");
                EndContext();
                BeginContext(638, 60, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "8df5f04b45cd40b48300e3ef1f429fb8", async() => {
                    BeginContext(686, 8, true);
                    WriteLiteral("Cadastro");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_2.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(698, 2, true);
                WriteLiteral("\r\n");
                EndContext();
#line 17 "/home/developer/SISGO/Apresentacao/src/Pages/Shared/_LoginPartial.cshtml"
            }

#line default
#line hidden
            BeginContext(711, 211, true);
            WriteLiteral("\r\n        \r\n\r\n      \r\n    </div>\r\n    <div class=\"collapse navbar-collapse\" id=\"myNavbar\">\r\n      \r\n      <ul class=\"nav navbar-nav navbar-right\">\r\n\r\n        <a class=\"navbar-brand\"><span class=\"blue\"> Usuário: ");
            EndContext();
            BeginContext(923, 18, false);
#line 27 "/home/developer/SISGO/Apresentacao/src/Pages/Shared/_LoginPartial.cshtml"
            Write(User.Identity.Name);

#line default
#line hidden
            EndContext();
            BeginContext(941, 219, true);
            WriteLiteral("</span></a>\r\n\r\n        <li class=\"dropdown\">\r\n        <a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">Pesquisas\r\n        <span class=\"caret\"></span></a>\r\n          <ul class=\"dropdown-menu\">\r\n            <li>");
            EndContext();
            BeginContext(1160, 116, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "7a4207664af140688c146412034f8e05", async() => {
                BeginContext(1219, 53, true);
                WriteLiteral("<span class=\"glyphicon glyphicon-search\"></span> Data");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_4.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1276, 23, true);
            WriteLiteral("</li>\r\n            <li>");
            EndContext();
            BeginContext(1299, 118, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "687af17014864bc7801ca239b86dc918", async() => {
                BeginContext(1359, 54, true);
                WriteLiteral("<span class=\"glyphicon glyphicon-search\"></span> Local");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_5.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1417, 23, true);
            WriteLiteral("</li>\r\n            <li>");
            EndContext();
            BeginContext(1440, 120, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "36060ec137e04278a6e1604a0cb7cd36", async() => {
                BeginContext(1501, 55, true);
                WriteLiteral("<span class=\"glyphicon glyphicon-search\"></span> Número");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_6.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1560, 49, true);
            WriteLiteral("</li>\r\n          </ul>\r\n        </li>\r\n\r\n        ");
            EndContext();
            BeginContext(1609, 219, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "a3120ff0865b46008a7b06288f56eecd", async() => {
                BeginContext(1690, 131, true);
                WriteLiteral("\r\n        <button type=\"submit\" class=\"btn btn-default\"><span class=\"glyphicon glyphicon-log-in\"></span>  Logout</button>\r\n        ");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Page = (string)__tagHelperAttribute_8.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.PageHandler = (string)__tagHelperAttribute_9.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_9);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1828, 47, true);
            WriteLiteral("\r\n      </ul>\r\n    </div>\r\n  </div>\r\n</nav>\r\n\r\n");
            EndContext();
        }
Exemplo n.º 38
0
 public ConnectorService(AuthorizationService authorizationService, ILogger <ConnectorService> logger)
 {
     _authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemplo n.º 39
0
 protected virtual Task CheckPolicyAsync(string policyName)
 {
     return(AuthorizationService.CheckAsync(policyName));
 }
Exemplo n.º 40
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(324, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 9 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"

            ViewData["Title"] = "Home Page";

#line default
#line hidden
            BeginContext(367, 94, true);
            WriteLiteral("\n<div class=\"jumbotron text-center\">\n    <h1 class=\"display-4 mb-5\">User Information</h1>\n    ");
            EndContext();
            BeginContext(461, 93, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "69084ffdacdc9c0e19198c686c3e4ba4bd4357b77559", async() => {
                BeginContext(542, 8, true);
                WriteLiteral("Add Item");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(554, 5, true);
            WriteLiteral("\n    ");
            EndContext();
            BeginContext(559, 98, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "69084ffdacdc9c0e19198c686c3e4ba4bd4357b79221", async() => {
                BeginContext(639, 14, true);
                WriteLiteral("View All Items");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(657, 87, true);
            WriteLiteral("\n</div>\n\n<section class=\"mb-5\" id=\"product-list\">\n    <h2 class=\"mb-4\">Your Items</h2>\n");
            EndContext();
#line 21 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
            foreach (var item in Model.Products)
            {
#line default
#line hidden
                BeginContext(792, 136, true);
                WriteLiteral("        <div class=\"card mb-3\">\n            <div class=\"row no-gutters\">\n                <div class=\"col-md-4\">\n                    <img");
                EndContext();
                BeginWriteAttribute("src", " src=\"", 928, "\"", 945, 1);
#line 26 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                WriteAttributeValue("", 934, item.Image, 934, 11, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(946, 136, true);
                WriteLiteral(" class=\"card-img\" alt\"...\" />\n                </div>\n                <div class=\"col-md-8\">\n                    <div class=\"card-body\">\n");
                EndContext();
#line 30 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                if (item.Available == 0)
                {
#line default
#line hidden
                    BeginContext(1158, 51, true);
                    WriteLiteral("                            <h5 class=\"cart-title\">");
                    EndContext();
                    BeginContext(1210, 39, false);
#line 32 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                    Write(Html.DisplayFor(modelItem => item.Name));

#line default
#line hidden
                    EndContext();
                    BeginContext(1249, 17, true);
                    WriteLiteral(" (SOLD OUT)</h5>\n");
                    EndContext();
#line 33 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                }
                else
                {
#line default
#line hidden
                    BeginContext(1347, 51, true);
                    WriteLiteral("                            <h5 class=\"cart-title\">");
                    EndContext();
                    BeginContext(1399, 39, false);
#line 36 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                    Write(Html.DisplayFor(modelItem => item.Name));

#line default
#line hidden
                    EndContext();
                    BeginContext(1438, 6, true);
                    WriteLiteral("</h5>\n");
                    EndContext();
#line 37 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(1470, 46, true);
                WriteLiteral("                        <p class=\"card-text\">$");
                EndContext();
                BeginContext(1517, 40, false);
#line 38 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Price));

#line default
#line hidden
                EndContext();
                BeginContext(1557, 68, true);
                WriteLiteral("</p>\n                        <p class=\"card-text d-none d-md-block\">");
                EndContext();
                BeginContext(1626, 46, false);
#line 39 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Description));

#line default
#line hidden
                EndContext();
                BeginContext(1672, 91, true);
                WriteLiteral("</p>\n                        <p class=\"card-text mb-5\"><small class=\"text-muted\">Posted on ");
                EndContext();
                BeginContext(1764, 41, false);
#line 40 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Posted));

#line default
#line hidden
                EndContext();
                BeginContext(1805, 37, true);
                WriteLiteral("</small></p>\n                        ");
                EndContext();
                BeginContext(1842, 123, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "69084ffdacdc9c0e19198c686c3e4ba4bd4357b715608", async() => {
                    BeginContext(1954, 7, true);
                    WriteLiteral("Details");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6);
                if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                {
                    throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                }
                BeginWriteTagHelperAttribute();
#line 41 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                WriteLiteral(item.ProductId);

#line default
#line hidden
                __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1965, 1, true);
                WriteLiteral("\n");
                EndContext();
#line 42 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                if ((await AuthorizationService.AuthorizeAsync(User, Model, "AccessPolicy")).Succeeded)
                {
#line default
#line hidden
                    BeginContext(2105, 28, true);
                    WriteLiteral("                            ");
                    EndContext();
                    BeginContext(2133, 74, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "69084ffdacdc9c0e19198c686c3e4ba4bd4357b718777", async() => {
                        BeginContext(2199, 4, true);
                        WriteLiteral("Edit");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
                    if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                    {
                        throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                    }
                    BeginWriteTagHelperAttribute();
#line 44 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                    WriteLiteral(item);

#line default
#line hidden
                    __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                    __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(2207, 1, true);
                    WriteLiteral("\n");
                    EndContext();
#line 45 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(2234, 24, true);
                WriteLiteral("                        ");
                EndContext();
#line 46 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                if ((await AuthorizationService.AuthorizeAsync(User, Model, "AccessPolicy")).Succeeded)
                {
#line default
#line hidden
                    BeginContext(2373, 28, true);
                    WriteLiteral("                            ");
                    EndContext();
                    BeginContext(2401, 88, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "69084ffdacdc9c0e19198c686c3e4ba4bd4357b722012", async() => {
                        BeginContext(2479, 6, true);
                        WriteLiteral("Delete");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_9.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_9);
                    if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null)
                    {
                        throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues"));
                    }
                    BeginWriteTagHelperAttribute();
#line 48 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                    WriteLiteral(item.ProductId);

#line default
#line hidden
                    __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
                    __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(2489, 1, true);
                    WriteLiteral("\n");
                    EndContext();
#line 49 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(2516, 84, true);
                WriteLiteral("                    </div>\n                </div>\n            </div>\n        </div>\n");
                EndContext();
#line 54 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(2606, 309, true);
            WriteLiteral(@"</section>
<section id=""customer-purchases""> 
    <h2 class=""mb-4"">Your Customers</h2>
        <table class=""table"">
            <thead>
                <tr>
                    <th>Customer Name</th>
                    <th>Purchase Amount</th>
                </tr>
            </thead>
            <tbody>
");
            EndContext();
#line 66 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
            foreach (var purchase in Model.Purchases)
            {
#line default
#line hidden
                BeginContext(2992, 82, true);
                WriteLiteral("                    <tr>\n                        <td>\n                            ");
                EndContext();
                BeginContext(3075, 61, false);
#line 70 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelPurchase => purchase.Customer.FirstName));

#line default
#line hidden
                EndContext();
                BeginContext(3136, 1, true);
                WriteLiteral(" ");
                EndContext();
                BeginContext(3138, 60, false);
#line 70 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelPurchase => purchase.Customer.LastName));

#line default
#line hidden
                EndContext();
                BeginContext(3198, 89, true);
                WriteLiteral("\n                        </td>\n                        <td>\n                            $");
                EndContext();
                BeginContext(3288, 49, false);
#line 73 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
                Write(Html.DisplayFor(modelPurchase => purchase.Amount));

#line default
#line hidden
                EndContext();
                BeginContext(3337, 57, true);
                WriteLiteral("\n                        </td>\n                    </tr>\n");
                EndContext();
#line 76 "C:\Users\sam_h\Study\Distributed_Development_HIT339\sam_hood_sales_board_application\SalesBoardApp\Views\Home\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(3412, 56, true);
            WriteLiteral("            </tbody>\n        </table>\n    </section>\n\n\n\n");
            EndContext();
        }
Exemplo n.º 41
0
        public HttpResponseMessage Create(TaskCreateApiModel apiModel)
        {
            var                  response              = new HttpResponseMessage();
            ResponseFormat       responseData          = new ResponseFormat();
            AuthorizationService _authorizationService = new AuthorizationService().SetPerm((int)EnumPermissions.TASK_CREATE);
            //read jwt

            IEnumerable <string> headerValues;

            if (Request.Headers.TryGetValues("Authorization", out headerValues))
            {
                string jwt = headerValues.FirstOrDefault();
                //validate jwt
                var payload = JwtTokenManager.ValidateJwtToken(jwt);

                if (payload.ContainsKey("error"))
                {
                    if ((string)payload["error"] == ErrorMessages.TOKEN_EXPIRED)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_EXPIRED;
                    }
                    if ((string)payload["error"] == ErrorMessages.TOKEN_INVALID)
                    {
                        response.StatusCode  = HttpStatusCode.Unauthorized;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.TOKEN_INVALID;
                    }
                }
                else
                {
                    var userId = payload["id"];

                    var isAuthorized = _authorizationService.Authorize(Convert.ToInt32(userId));
                    if (isAuthorized)
                    {
                        var isCreated = _taskTemplateService.CreateTask(apiModel, Convert.ToInt32(userId));;
                        if (isCreated)
                        {
                            response.StatusCode  = HttpStatusCode.OK;
                            responseData         = ResponseFormat.Success;
                            responseData.message = SuccessMessages.TASK_CREATED;
                        }
                    }
                    else
                    {
                        response.StatusCode  = HttpStatusCode.Forbidden;
                        responseData         = ResponseFormat.Fail;
                        responseData.message = ErrorMessages.UNAUTHORIZED;
                    }
                }
            }
            else
            {
                response.StatusCode  = HttpStatusCode.Unauthorized;
                responseData         = ResponseFormat.Fail;
                responseData.message = ErrorMessages.UNAUTHORIZED;
            }
            var json = JsonConvert.SerializeObject(responseData);

            response.Content = new StringContent(json, Encoding.UTF8, "application/json");
            return(response);
        }
Exemplo n.º 42
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(154, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 6 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"

            ViewData["Title"] = "Roles | Index";
            Layout            = "~/Areas/Admin/Views/Shared/_Layout.cshtml";

#line default
#line hidden
            BeginContext(264, 828, true);
            WriteLiteral(@"<div class="""">
    <div class=""page-title"">
        <div class=""title_left"">
            <h3>Admin <small>Roles</small></h3>
        </div>

        <div class=""title_right"">
            <div class=""col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search"">
                <div class=""input-group"">
                    <input type=""text"" class=""form-control"" placeholder=""Search for..."">
                    <span class=""input-group-btn"">
                        <button class=""btn btn-default"" type=""button"">Go!</button>
                    </span>
                </div>
            </div>
        </div>
    </div>

    <div class=""clearfix""></div>

    <div class=""row"">
        <div class=""col-md-12 col-sm-12 col-xs-12"">
            <div class=""x_panel"">
                <div class=""x_title"">
");
            EndContext();
#line 35 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"

            var checkCreate = await AuthorizationService.AuthorizeAsync(User, FunctionConstant.Role, Operations.Create);

            var checkUpdate = await AuthorizationService.AuthorizeAsync(User, FunctionConstant.Role, Operations.Update);

            var checkDelete = await AuthorizationService.AuthorizeAsync(User, FunctionConstant.Role, Operations.Delete);

            var checkRead = await AuthorizationService.AuthorizeAsync(User, FunctionConstant.Role, Operations.Read);

            if (checkCreate.Succeeded)
            {
#line default
#line hidden
                BeginContext(1811, 364, true);
                WriteLiteral(@"                            <div class=""nav navbar-right panel_toolbox"">
                                <button type=""button"" class=""btn btn-success""><i class=""fa fa-download""></i> Import</button>
                                <button type=""button"" class=""btn btn-success""><i class=""fa fa-cloud-upload""></i> Export</button>
                                <a");
                EndContext();
                BeginWriteAttribute("href", " href=\"", 2175, "\"", 2207, 1);
#line 49 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                WriteAttributeValue("", 2182, RouteConstant.RoleCreate, 2182, 25, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(2208, 109, true);
                WriteLiteral(" class=\"btn btn-success\"><i class=\"fa fa-external-link\"></i> Create</a>\r\n                            </div>\r\n");
                EndContext();
#line 51 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
            }


#line default
#line hidden
            BeginContext(2367, 1638, true);
            WriteLiteral(@"
                    <div class=""clearfix""></div>
                </div>

                <div class=""x_content"">

                    <div class=""table-responsive"">
                        <table class=""table table-striped jambo_table bulk_action"">
                            <thead>
                                <tr class=""headings"">
                                    <th>
                                        <input type=""checkbox"" id=""check-all"" class=""flat"">
                                    </th>
                                    <th class=""column-title"" style=""display: table-cell;"">Name </th>
                                    <th class=""column-title"" style=""display: table-cell;"">Description </th>
                                    <th class=""column-title"" style=""display: table-cell;"">Status </th>
                                    <th class=""column-title"" style=""display: table-cell;"">Last Updated </th>

                                    <th class=""column-title no-link l");
            WriteLiteral(@"ast"" style=""display: table-cell;"">
                                        <span class=""nobr"">Action</span>
                                    </th>
                                    <th class=""bulk-actions"" colspan=""7"" style=""display: none;"">
                                        <a class=""antoo"" style=""color:#fff; font-weight:500;"">Bulk Actions ( <span class=""action-cnt"">1 Records Selected</span> ) <i class=""fa fa-chevron-down""></i></a>
                                    </th>
                                </tr>
                            </thead>

                            <tbody>

");
            EndContext();
#line 82 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"

            int key = 0;

            foreach (var role in Model)
            {
                string trClass = key % 2 == 0 ? "even" : "odd";

#line default
#line hidden
                BeginContext(4286, 43, true);
                WriteLiteral("                                        <tr");
                EndContext();
                BeginWriteAttribute("class", " class=\"", 4329, "\"", 4355, 2);
#line 88 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                WriteAttributeValue("", 4337, trClass, 4337, 10, false);

#line default
#line hidden
                WriteAttributeValue(" ", 4347, "pointer", 4348, 8, true);
                EndWriteAttribute();
                BeginContext(4356, 287, true);
                WriteLiteral(@">
                                            <td class=""a-center "">
                                                <input type=""checkbox"" class=""flat"" name=""table_records"">
                                            </td>
                                            <td class="" "">");
                EndContext();
                BeginContext(4644, 9, false);
#line 92 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                Write(role.Name);

#line default
#line hidden
                EndContext();
                BeginContext(4653, 65, true);
                WriteLiteral("</td>\r\n                                            <td class=\" \">");
                EndContext();
                BeginContext(4719, 16, false);
#line 93 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                Write(role.Description);

#line default
#line hidden
                EndContext();
                BeginContext(4735, 65, true);
                WriteLiteral("</td>\r\n                                            <td class=\" \">");
                EndContext();
                BeginContext(4801, 15, false);
#line 94 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                Write(role.DateCreted);

#line default
#line hidden
                EndContext();
                BeginContext(4816, 67, true);
                WriteLiteral("</td>\r\n                                            <td class=\" \">\r\n");
                EndContext();
#line 96 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                if (role.Status == Status.Active)
                {
#line default
#line hidden
                    BeginContext(5018, 122, true);
                    WriteLiteral("                                                    <button type=\'button\' class=\'btn btn-success btn-xs\'>Active</button>\r\n");
                    EndContext();
#line 99 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                }
                else
                {
#line default
#line hidden
                    BeginContext(5296, 123, true);
                    WriteLiteral("                                                    <button type=\'button\' class=\'btn btn-danger btn-xs\'>Deactive</button>\r\n");
                    EndContext();
#line 103 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(5470, 116, true);
                WriteLiteral("                                            </td>\r\n\r\n                                            <td class=\"last\">\r\n");
                EndContext();
#line 107 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                if (checkRead.Succeeded)
                {
#line default
#line hidden
                    BeginContext(5712, 54, true);
                    WriteLiteral("                                                    <a");
                    EndContext();
                    BeginWriteAttribute("href", " href=\"", 5766, "\"", 5814, 1);
#line 109 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                    WriteAttributeValue("", 5773, RouteConstant.RoleView + "/" + role.Id, 5773, 41, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(5815, 72, true);
                    WriteLiteral(" class=\"btn btn-primary btn-xs\"><i class=\"fa fa-folder\"></i> View </a>\r\n");
                    EndContext();
#line 110 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(5938, 48, true);
                WriteLiteral("                                                ");
                EndContext();
#line 111 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                if (checkUpdate.Succeeded)
                {
#line default
#line hidden
                    BeginContext(6066, 54, true);
                    WriteLiteral("                                                    <a");
                    EndContext();
                    BeginWriteAttribute("href", " href=\"", 6120, "\"", 6170, 1);
#line 113 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                    WriteAttributeValue("", 6127, RouteConstant.RoleUpdate + "/" + role.Id, 6127, 43, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(6171, 69, true);
                    WriteLiteral(" class=\"btn btn-info btn-xs\"><i class=\"fa fa-pencil\"></i> Edit </a>\r\n");
                    EndContext();
#line 114 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(6291, 48, true);
                WriteLiteral("                                                ");
                EndContext();
#line 115 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                if (checkDelete.Succeeded)
                {
#line default
#line hidden
                    BeginContext(6419, 52, true);
                    WriteLiteral("                                                    ");
                    EndContext();
                    BeginContext(6471, 381, false);
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3419b58ac47fa902bb4092a70f3470ab2a4da92516894", async() => {
                        BeginContext(6527, 88, true);
                        WriteLiteral("\r\n                                                        <input type=\"hidden\" name=\"Id\"");
                        EndContext();
                        BeginWriteAttribute("value", " value=\"", 6615, "\"", 6631, 1);
#line 118 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                        WriteAttributeValue("", 6623, role.Id, 6623, 8, false);

#line default
#line hidden
                        EndWriteAttribute();
                        BeginContext(6632, 213, true);
                        WriteLiteral(" />\r\n                                                        <button type=\"submit\" class=\"btn btn-danger btn-xs\"><i class=\"fa fa-trash-o\"></i> Delete </button>\r\n                                                    ");
                        EndContext();
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_1.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    EndContext();
                    BeginContext(6852, 2, true);
                    WriteLiteral("\r\n");
                    EndContext();
#line 121 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                }

#line default
#line hidden
                BeginContext(6905, 98, true);
                WriteLiteral("                                            </td>\r\n                                        </tr>\r\n");
                EndContext();
#line 124 "C:\.NetCoreLive\qhnam.story\story\story\Areas\Admin\Views\AppRole\Index.cshtml"
                key++;
            }


#line default
#line hidden
            BeginContext(7125, 188, true);
            WriteLiteral("                            </tbody>\r\n                        </table>\r\n                    </div>\r\n\r\n\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</div>\r\n\r\n\r\n");
            EndContext();
        }
Exemplo n.º 43
0
 public UserController(UserManager <USER> userManager, AuthorizationService userService)
 {
     _userManager = userManager;
     _userService = userService;
 }
Exemplo n.º 44
0
 private void AddError(AuthorizationService.StatusType Status)
 {
     _Errors.Add(DateTime.Now, Status);
 }