Exemplo n.º 1
0
    private void Display_EditPermissions()
    {
        long nFolderId;

        if (_ItemType == "folder")
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
            nFolderId = _Id;
            if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum))
            {
                _IsBoard = true;
            }
            else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog))
            {
                _IsBlog = true;
            }
        }
        else
        {
            _ContentData = _ContentApi.GetContentById(_Id, 0);
            _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId);
            nFolderId = _ContentData.FolderId;
        }
        EditPermissionsToolBar();
        _PageData = new Collection();
        UserPermissionData[] userpermission_data;
        UserGroupData usergroup_data;
        UserData user_data;
        UserAPI m_refUserAPI = new UserAPI();
        if (Request.QueryString["base"] == "group")
        {
            userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, 0, Request.QueryString["PermID"], ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All); //cTmp = ContObj.GetOrderedItemPermissionsv2_0(cTmp, retString)
            usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]));
            _IsMembership = usergroup_data.IsMemberShipGroup;
        }
        else
        {
            userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, Convert.ToInt64(Request.QueryString["PermID"]), "", ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All);
            user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false);
            _IsMembership = user_data.IsMemberShip;

        }
        frm_itemid.Value = _Id.ToString();
        frm_type.Value = Request.QueryString["type"];
        frm_base.Value = _Base;
        frm_permid.Value = Request.QueryString["PermID"];
        frm_membership.Value = Request.QueryString["membership"];

        if (_IsMembership)
        {
            td_ep_membership.Visible = false;
            hmembershiptype.Value = "1";
        }
        else
        {
            td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt();
            hmembershiptype.Value = "0";
        }
        Populate_EditPermissionsGenericGrid(userpermission_data);
        Populate_EditPermissionsAdvancedGrid(userpermission_data);
    }
Exemplo n.º 2
0
    private void Display_AddPermissions()
    {
        UserGroupData usergroup_data;
        System.Collections.Generic.List<UserGroupData> userGroupDataList = new System.Collections.Generic.List<UserGroupData>();
        UserData user_data;
        System.Collections.Generic.List<UserData> userDataList = new System.Collections.Generic.List<UserData>();
        UserAPI m_refUserAPI = new UserAPI();
        long nFolderId;

        frm_itemid.Value = _Id.ToString();
        frm_type.Value = Request.QueryString["type"];
        frm_base.Value = Request.QueryString["base"];
        frm_permid.Value = Request.QueryString["PermID"];
        frm_membership.Value = Request.QueryString["membership"];

        if (_ItemType == "folder")
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
            nFolderId = _Id;
            if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum))
            {
                _IsBoard = true;
            }
            else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog))
            {
                _IsBlog = true;
            }
        }
        else
        {
            _ContentData = _ContentApi.GetContentById(_Id, 0);
            _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId);
            nFolderId = _ContentData.FolderId;
        }
        AddPermissionsToolBar();
        if (Request.QueryString["base"] == "group")
        {
            usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]));
            Populate_AddPermissionsGenericGrid(usergroup_data);
            Populate_AddPermissionsAdvancedGrid(usergroup_data);
            _IsMembership = usergroup_data.IsMemberShipGroup;
        }
        else if (Request.QueryString["base"] == "user")
        {
            user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false);
            Populate_AddPermissionsGenericGrid(user_data);
            Populate_AddPermissionsAdvancedGrid(user_data);
            _IsMembership = user_data.IsMemberShip;
        }
        else
        {
            string[] Groups = Request.QueryString["groupIDS"].Split(",".ToCharArray());
            string[] Users = Request.QueryString["userIDS"].Split(",".ToCharArray());
            int groupCount = 0;
            int userCount = 0;

            if (Request.QueryString["groupIDS"] != "")
            {
                for (groupCount = 0; groupCount <= Groups.Length - 1; groupCount++)
                {
                    userGroupDataList.Add(m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Groups[groupCount])));
                }
                _IsMembership = userGroupDataList[0].IsMemberShipGroup;
            }
            if (Request.QueryString["userIDS"] != "")
            {
                for (userCount = 0; userCount <= Users.Length - 1; userCount++)
                {
                    userDataList.Add(m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Users[userCount]), false, false));
                }
                _IsMembership = userDataList[0].IsMemberShip;
            }
            Populate_AddPermissionsGenericGridForUsersAndGroup(userGroupDataList, userDataList);
            Populate_AddPermissionsAdvancedGridForUsersAndGroup(userGroupDataList, userDataList);
        }

        if (_IsMembership)
        {
            td_ep_membership.Visible = false;
            hmembershiptype.Value = "1";
        }
        else
        {
            td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt();
            hmembershiptype.Value = "0";
        }
    }