当前位置: 首页>>代码示例>>C#>>正文


C# CurrentUserInfo.IsAuthorizedPerResource方法代码示例

本文整理汇总了C#中CurrentUserInfo.IsAuthorizedPerResource方法的典型用法代码示例。如果您正苦于以下问题:C# CurrentUserInfo.IsAuthorizedPerResource方法的具体用法?C# CurrentUserInfo.IsAuthorizedPerResource怎么用?C# CurrentUserInfo.IsAuthorizedPerResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurrentUserInfo的用法示例。


在下文中一共展示了CurrentUserInfo.IsAuthorizedPerResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = MembershipContext.AuthenticatedUser;
        if (userId <= 0 && currentUser != null)
        {
            userId = currentUser.UserID;
        }

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check 'manage' permission
        bool friendsManagePermission = currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage") || (currentUser.UserID == userId);

        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        // Check that only global administrator can edit global administrator's accounts
        if (userId > 0)
        {
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                ScriptHelper.RegisterDialogScript(this);
                FriendsList.UserID = userId;
                FriendsList.OnCheckPermissions += CheckPermissions;
                FriendsList.ZeroRowsText = GetString("friends.nouserfriends");

                // Request friend link
                string script =
                    "function displayRequest(){ \n" +
                    "modalDialog('" + AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Friends/Dialogs/Friends_Request.aspx") + "?userid=" + userId + "&siteid=" + SiteID + "', 'rejectDialog', 810, 460);}";

                ScriptHelper.RegisterStartupScript(this, GetType(), "displayModalRequest", ScriptHelper.GetScript(script));

                HeaderAction action = new HeaderAction();
                action.Text = GetString("Friends_List.NewItemCaption");
                action.OnClientClick = "displayRequest();";
                action.RedirectUrl = null;
                action.Enabled = friendsManagePermission;
                CurrentMaster.HeaderActions.AddAction(action);
            }
        }
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:59,代码来源:User_Edit_Friends_Approved.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;

        if (currentUser == null)
        {
            return;
        }

        // Check 'ReadForm' permission
        if (!currentUser.IsAuthorizedPerResource("cms.form", "ReadForm"))
        {
            RedirectToAccessDenied("cms.form", "ReadForm");
        }

        UniGridBizForms.OnAction += UniGridBizForms_OnAction;
        UniGridBizForms.OnAfterRetrieveData += uniGrid_OnAfterRetrieveData;
        UniGridBizForms.HideControlForZeroRows = false;
        UniGridBizForms.ZeroRowsText = GetString("general.nodatafound");
        UniGridBizForms.WhereCondition = "FormSiteID = " + SiteContext.CurrentSiteID;

        PageTitle.TitleText = GetString("BizFormList.TitleText");

        InitHeaderActions();
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:25,代码来源:BizForm_List.aspx.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check hash
        if (!QueryHelper.ValidateHash("hash"))
        {
            RedirectToAccessDenied(ResHelper.GetString("dialogs.badhashtitle"));
        }

        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = CMSContext.CurrentUser;

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check license
        if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Friends);
        }

        if (userId > 0)
        {
            // Check that only global administrator can edit global administrator's accounts
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                string imagePath = GetImageUrl("Objects/CMS_Friend/");
                ScriptHelper.RegisterDialogScript(this);
                FriendsListRequested.UserID = userId;
                FriendsListRequested.OnCheckPermissions += CheckPermissions;
                FriendsListRequested.ZeroRowsText = GetString("friends.nouserrequestedfriends");

                // Request friend link
                string script =
                    "function displayRequest(){ \n" +
                        "modalDialog('" + CMSContext.ResolveDialogUrl("~/CMSModules/Friends/Dialogs/Friends_Request.aspx") + "?userid=" + userId + "&siteid=" + SiteID + "', 'rejectDialog', 480, 350);}";

                ScriptHelper.RegisterStartupScript(this, GetType(), "displayModalRequest", ScriptHelper.GetScript(script));
                string[,] actions = new string[1, 6];
                actions[0, 0] = HeaderActions.TYPE_HYPERLINK;
                actions[0, 1] = GetString("Friends_List.NewItemCaption");
                actions[0, 2] = null;
                actions[0, 3] = "javascript:displayRequest();";
                actions[0, 4] = null;
                actions[0, 5] = imagePath + "add.png";
                CurrentMaster.HeaderActions.Actions = actions;
            }
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:60,代码来源:User_Edit_Friends_Requested.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = CMSContext.CurrentUser;

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check license
        if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Friends);
        }

        // initializes breadcrumbs
        string[,] pageTitleTabs = new string[1, 3];
        pageTitleTabs[0, 0] = GetString("friends.friends");
        pageTitleTabs[0, 1] = "";
        pageTitleTabs[0, 2] = "";

        CurrentMaster.Title.Breadcrumbs = pageTitleTabs;
        CurrentMaster.Title.HelpTopicName = "friends_myfriends";
        CurrentMaster.Title.HelpName = "helpTopic";

        if (!RequestHelper.IsPostBack())
        {
            InitalizeMenu();
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:32,代码来源:User_Edit_Friends_Header.aspx.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = CMSContext.CurrentUser;

        if (currentUser == null)
        {
            return;
        }

        // Check 'ReadForm' permission
        if (!currentUser.IsAuthorizedPerResource("cms.form", "ReadForm"))
        {
            RedirectToCMSDeskAccessDenied("cms.form", "ReadForm");
        }

        UniGridBizForms.OnAction += new OnActionEventHandler(UniGridBizForms_OnAction);
        UniGridBizForms.OnAfterRetrieveData += new OnAfterRetrieveData(uniGrid_OnAfterRetrieveData);
        UniGridBizForms.HideControlForZeroRows = false;
        UniGridBizForms.ZeroRowsText = GetString("general.nodatafound");
        UniGridBizForms.WhereCondition = "FormSiteID = " + CMSContext.CurrentSiteID;

        // New item link
        string[,] actions = new string[1,6];
        actions[0, 0] = HeaderActions.TYPE_HYPERLINK;
        actions[0, 1] = GetString("BizFormList.lnkNewBizForm");
        actions[0, 2] = null;
        actions[0, 3] = ResolveUrl("BizForm_New.aspx");
        actions[0, 4] = null;
        actions[0, 5] = GetImageUrl("Objects/CMS_Form/add.png");

        CurrentMaster.HeaderActions.Actions = actions;
        CurrentMaster.Title.TitleText = GetString("BizFormList.TitleText");
        CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Form/object.png");
        CurrentMaster.Title.HelpTopicName = "bizforms";
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:35,代码来源:BizForm_List.aspx.cs

示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check the current user
        currentUser = CMSContext.CurrentUser;
        if (currentUser == null)
        {
            return;
        }

        // Check 'Read' permission
        if (currentUser.IsAuthorizedPerResource("cms.blog", "Read"))
        {
            readBlogs = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            this.drpBlogs.Items.Add(new ListItem(GetString("general.selectall"), "##ALL##"));
            this.drpBlogs.Items.Add(new ListItem(GetString("blog.selectmyblogs"), "##MYBLOGS##"));
        }

        // No cms.blog doc. type
        if (DataClassInfoProvider.GetDataClass("cms.blog") == null)
        {
            RedirectToInformation(GetString("blog.noblogdoctype"));
        }

        this.CurrentMaster.DisplaySiteSelectorPanel = true;

        gridBlogs.OnDataReload += gridBlogs_OnDataReload;
        gridBlogs.ZeroRowsText = GetString("general.nodatafound");
        gridBlogs.ShowActionsMenu = true;
        gridBlogs.Columns = "BlogID, BlogName, NodeID, DocumentCulture";

        // Get all possible columns to retrieve
        IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di = new DocumentInfo();
        BlogInfo bi = new BlogInfo();
        gridBlogs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));

        DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.blogpost");
        string classId = "";
        StringBuilder script = new StringBuilder();

        if (dci != null)
        {
            classId = dci.ClassID.ToString();
        }

        // Get script to redirect to new blog post page
        script.Append("function NewPost(parentId, culture) {",
                     "  if (parentId != 0) {",
                     "     parent.parent.parent.location.href = \"", ResolveUrl("~/CMSDesk/default.aspx"), "?section=content&action=new&nodeid=\" + parentId + \"&classid=", classId, " &culture=\" + culture;",
                     "}}");

        // Generate javascript code
        ltlScript.Text = ScriptHelper.GetScript(script.ToString());
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:58,代码来源:Blogs_Blogs_List.aspx.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check the current user
        currentUser = MembershipContext.AuthenticatedUser;
        if (currentUser == null)
        {
            return;
        }

        // Check 'Read' permission
        if (currentUser.IsAuthorizedPerResource("cms.blog", "Read"))
        {
            readBlogs = true;
        }

        // Prepare permissions for external data bound
        contentExploreTreePermission = currentUser.IsAuthorizedPerResource("cms.content", "exploretree");
        contentReadPermission = currentUser.IsAuthorizedPerResource("cms.content", "read");
        contentCreatePermission = currentUser.IsAuthorizedPerResource("cms.content", "create");

        if (!RequestHelper.IsPostBack())
        {
            drpBlogs.Items.Add(new ListItem(GetString("general.selectall"), "##ALL##"));
            drpBlogs.Items.Add(new ListItem(GetString("blog.selectmyblogs"), "##MYBLOGS##"));
        }

        // No cms.blog doc. type
        if (DataClassInfoProvider.GetDataClassInfo("cms.blog") == null)
        {
            RedirectToInformation(GetString("blog.noblogdoctype"));
        }

        CurrentMaster.DisplaySiteSelectorPanel = true;

        gridBlogs.OnDataReload += gridBlogs_OnDataReload;
        gridBlogs.ZeroRowsText = GetString("general.nodatafound");
        gridBlogs.ShowActionsMenu = true;
        gridBlogs.Columns = "BlogID, BlogName, NodeID, DocumentCulture";
        gridBlogs.OnExternalDataBound += gridBlogs_OnExternalDataBound;

        // Get all possible columns to retrieve
        gridBlogs.AllColumns = SqlHelper.JoinColumnList(ObjectTypeManager.GetColumnNames(BlogInfo.OBJECT_TYPE, PredefinedObjectType.NODE, PredefinedObjectType.DOCUMENTLOCALIZATION));
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:43,代码来源:Blogs_Blogs_List.aspx.cs

示例8: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check the current user
        currentUser = CMSContext.CurrentUser;
        if (currentUser == null)
        {
            return;
        }

        // Check 'Read' permission
        if (currentUser.IsAuthorizedPerResource("cms.blog", "Read"))
        {
            readBlogs = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            this.drpBlogs.Items.Add(new ListItem(GetString("general.selectall"), "##ALL##"));
            this.drpBlogs.Items.Add(new ListItem(GetString("blog.selectmyblogs"), "##MYBLOGS##"));
        }

        // No cms.blog doc. type
        if (DataClassInfoProvider.GetDataClass("cms.blog") == null)
        {
            RedirectToInformation(GetString("blog.noblogdoctype"));
        }

        this.CurrentMaster.DisplaySiteSelectorPanel = true;

        this.gridBlogs.OnDataReload += new OnDataReloadEventHandler(gridBlogs_OnDataReload);
        this.gridBlogs.ZeroRowsText = GetString("general.nodatafound");

        DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.blogpost");
        string classId = "";
        string script = "";

        if (dci != null)
        {
            classId = dci.ClassID.ToString();
        }

        // Get script to redirect to new blog post page
        script += "function NewPost(parentId, culture) { \n";
        script += "     if (parentId != 0) { \n";
        script += "         parent.parent.parent.location.href = \"" + ResolveUrl("~/CMSDesk/default.aspx") + "?section=content&action=new&nodeid=\" + parentId + \"&classid=" + classId + "&culture=\" + culture;";
        script += "}} \n";

        // Generate javascript code
        ltlScript.Text = ScriptHelper.GetScript(script);
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:50,代码来源:Blogs_Blogs_List.aspx.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = CMSContext.CurrentUser;

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check license
        if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Friends);
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:17,代码来源:User_Edit_Friends_Frameset.aspx.cs

示例10: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check hash
        if (!QueryHelper.ValidateHash("hash"))
        {
            RedirectToAccessDenied(ResHelper.GetString("dialogs.badhashtitle"));
        }

        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = CMSContext.CurrentUser;

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check license
        if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Friends);
        }

        if (userId > 0)
        {
            // Check that only global administrator can edit global administrator's accounts
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                ScriptHelper.RegisterDialogScript(this);
                FriendsListRejected.UserID = userId;
                FriendsListRejected.UseEncapsulation = false;
                FriendsListRejected.OnCheckPermissions += CheckPermissions;
                FriendsListRejected.ZeroRowsText = GetString("friends.nouserrejectedfriends");
            }
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:45,代码来源:User_Edit_Friends_Rejected.aspx.cs

示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = MembershipContext.AuthenticatedUser;
        if (userId <= 0 && currentUser != null)
        {
            userId = currentUser.UserID;
        }

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        if (userId > 0)
        {
            // Check that only global administrator can edit global administrator's accounts
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                ScriptHelper.RegisterDialogScript(this);
                FriendsListToApprove.UserID = userId;
                FriendsListToApprove.OnCheckPermissions += CheckPermissions;
                FriendsListToApprove.ZeroRowsText = GetString("friends.nouserwaitingfriends");
            }
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:42,代码来源:User_Edit_Friends_ToApprove.aspx.cs

示例12: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        userId = QueryHelper.GetInteger("userid", 0);
        currentUser = MembershipContext.AuthenticatedUser;

        // Check if request is for current user or another user with permission to manage it
        if (currentUser.IsPublic() || ((currentUser.UserID != userId) && !currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage")))
        {
            RedirectToAccessDenied("CMS.Friends", "Manage");
        }

        int requestedUserId = QueryHelper.GetInteger("requestid", 0);
        PageTitle.TitleText = GetString("friends.addnewfriend");
        FriendsRequest.UserID = userId;
        FriendsRequest.RequestedUserID = requestedUserId;
        FriendsRequest.IsLiveSite = true;

        if (requestedUserId != 0)
        {
            string fullUserName = String.Empty;

            UserInfo requestedUser = UserInfoProvider.GetUserInfo(requestedUserId);
            if (requestedUser != null)
            {
                fullUserName = Functions.GetFormattedUserName(requestedUser.UserName, requestedUser.FullName, requestedUser.UserNickName, true);
            }

            Page.Title = string.Format(GetString("friends.requestfriendshipwith"), HTMLHelper.HTMLEncode(fullUserName));
            PageTitle.TitleText = Page.Title;
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:37,代码来源:Friends_Request.aspx.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = CMSContext.CurrentUser;
        if (currentUser == null)
        {
            return;
        }

        // No cms.blog doc. type
        if (DataClassInfoProvider.GetDataClass("cms.blog") == null)
        {
            RedirectToInformation(GetString("blog.noblogdoctype"));
        }

        // Check if user is authorized to manage
        isAuthorized = currentUser.IsAuthorizedPerResource("CMS.Blog", "Manage") || (currentUser.IsAuthorizedPerClassName("cms.blog", "Manage", CMSContext.CurrentSiteName) &&
                       currentUser.IsAuthorizedPerClassName("cms.blogpost", "Manage", CMSContext.CurrentSiteName));

        // Register grid events
        this.gridBlogs.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridBlogs_OnExternalDataBound);
        this.gridBlogs.OnDataReload += new OnDataReloadEventHandler(gridBlogs_OnDataReload);

        // Get ClassID of the 'cms.blogpost' class
        DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.blogpost");
        string classId = "";
        string script = "";

        if (dci != null)
        {
            classId = dci.ClassID.ToString();
        }

        // Get scritp to redirect to new blog post page
        script += "function NewPost(parentId, culture) { \n";
        script += "     if (parentId != 0) { \n";
        script += "         parent.parent.parent.location.href = \"" + ResolveUrl("~/CMSDesk/default.aspx") + "?section=content&action=new&nodeid=\" + parentId + \"&classid=" + classId + "&culture=\" + culture;";
        script += "}} \n";

        // Generate javascript code
        ltlScript.Text = ScriptHelper.GetScript(script);
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:41,代码来源:MyBlogs_Blogs_List.aspx.cs

示例14: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Initialize current user for the async actions
        currentUser = MembershipContext.AuthenticatedUser;

        if (!RequestHelper.IsCallback())
        {
            // Check 'Manage object tasks' permission
            if (!currentUser.IsAuthorizedPerResource("cms.staging", "ManageAllTasks"))
            {
                RedirectToAccessDenied("cms.staging", "ManageAllTasks");
            }

            currentSiteId = SiteContext.CurrentSiteID;
            currentSiteName = SiteContext.CurrentSiteName;

            ucDisabledModule.SettingsKeys = "CMSStagingLogObjectChanges;CMSStagingLogDataChanges;CMSStagingLogChanges";
            ucDisabledModule.InfoText = GetString("AllTasks.TaskSeparator");
            ucDisabledModule.AtLeastOne = true;
            ucDisabledModule.ShowButtons = false;
            ucDisabledModule.SiteOrGlobal = true;
            ucDisabledModule.ParentPanel = pnlNotLogged;

            if (!ucDisabledModule.Check())
            {
                pnlFooter.Visible = false;
                plcContent.Visible = false;
                return;
            }

            // Register the dialog script
            ScriptHelper.RegisterDialogScript(this);
            serverId = QueryHelper.GetInteger("serverid", 0);

            // Setup title
            if (!ControlsHelper.CausedPostBack(btnSyncSelected, btnSyncAll))
            {
                plcContent.Visible = true;

                // Initialize buttons
                btnCancel.Attributes.Add("onclick", ctlAsync.GetCancelScript(true) + "return false;");
                btnCancel.Text = GetString("General.Cancel");
                btnDeleteAll.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";
                btnSyncSelected.OnClientClick = "return !" + gridTasks.GetCheckSelectionScript();

                // Initialize grid
                gridTasks.ZeroRowsText = GetString("Tasks.NoTasks");
                gridTasks.OnAction += gridTasks_OnAction;
                gridTasks.OnDataReload += gridTasks_OnDataReload;
                gridTasks.OnExternalDataBound += gridTasks_OnExternalDataBound;
                gridTasks.ShowActionsMenu = true;
                gridTasks.Columns = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";

                StagingTaskInfo ti = new StagingTaskInfo();
                gridTasks.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                pnlLog.Visible = false;
            }
        }

        ctlAsync.OnFinished += ctlAsync_OnFinished;
        ctlAsync.OnError += ctlAsync_OnError;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnCancel += ctlAsync_OnCancel;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:69,代码来源:Tasks.aspx.cs

示例15: Page_Load


//.........这里部分代码省略.........

        // Create query parameters
        QueryDataParameters parameters = new QueryDataParameters();

        if (ListingType == ListingTypeEnum.OutdatedDocuments)
        {
            parameters.Add("@SiteID", CMSContext.CurrentSite.SiteID);

            DateTime olderThan = DateTime.Now;
            int dateTimeValue = ValidationHelper.GetInteger(txtFilter.Text, 0);
            if (drpFilter.SelectedValue == strDays)
            {
                olderThan = olderThan.AddDays(-dateTimeValue);
            }
            else if (drpFilter.SelectedValue == strWeeks)
            {
                olderThan = olderThan.AddDays(-dateTimeValue * 7);
            }
            else if (drpFilter.SelectedValue == strMonths)
            {
                olderThan = olderThan.AddMonths(-dateTimeValue);
            }
            else if (drpFilter.SelectedValue == strYears)
            {
                olderThan = olderThan.AddYears(-dateTimeValue);
            }

            parameters.Add("@OlderThan", olderThan);
        }
        // Initialize UserID query parameter
        int userID = currentUserInfo.UserID;
        if (ListingType == ListingTypeEnum.PendingDocuments)
        {
            if ((currentUserInfo.IsGlobalAdministrator) || (currentUserInfo.IsAuthorizedPerResource("CMS.Content", "manageworkflow")))
            {
                userID = -1;
            }
        }

        parameters.Add("@UserID", userID);

        // Document Age
        if (DocumentAge != String.Empty)
        {
            string[] ages = DocumentAge.Split(';');
            if (ages.Length == 2)
            {
                // Add from a to values to temp parameters
                int from = ValidationHelper.GetInteger(ages[1], 0);
                int to = ValidationHelper.GetInteger(ages[0], 0);

                if (from > 0)
                {
                    gridElem.WhereCondition = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, SOURCE_MODIFIEDWHEN + " >= @FROM");
                    parameters.Add("@FROM", DateTime.Now.AddDays((-1) * from));
                }

                if (to > 0)
                {
                    gridElem.WhereCondition = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, SOURCE_MODIFIEDWHEN + " <= @TO");
                    parameters.Add("@TO", DateTime.Now.AddDays((-1) * to));
                }
            }
        }

        // Site name
开发者ID:jiva,项目名称:Kentico,代码行数:67,代码来源:Documents.ascx.cs


注:本文中的CurrentUserInfo.IsAuthorizedPerResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。