示例#1
0
    protected bool CheckAccess()
    {
        ContentAPI contentApi = new ContentAPI();
        Utilities.ValidateUserLogin();
        if (contentApi.IsLoggedIn)
        {
            if ((!(Page.Request.QueryString["res_type"] == null)) && Page.Request.QueryString["res_type"].ToLower() == "content")
            {

                long contentId = System.Convert.ToInt32(Page.Request.QueryString["res"]);
                ContentAPI.userPermissions permissions = contentApi.GetUserPermissionsForContent(contentId);

                if (Ektron.Cms.Common.EkFunctions.GetBit((long)ContentAPI.userPermissions.View, (long)permissions))
                {
                    return true;
                }
                if (Ektron.Cms.Common.EkFunctions.GetBit((long)ContentAPI.userPermissions.Edit, (long)permissions))
                {
                    return true;
                }
            }
            else
            {
                return true; //this isn't content - return true.
            }
        }

        return false;
    }