示例#1
0
        private bool SaveUserGroup()
        {
            if (!CanSave())
            {
                return(false);
            }

            UserGroupEntity UserGroup = new UserGroupEntity();

            UserGroup.UserGroupCode = txtUserGroupCode.Text;
            UserGroup.UserGroupName = txtUserGroupName.Text;

            UserGroup.UserGroupID = new Guid(txtUserGroupCode.Tag.ToString());

            if (UserGroup.UserGroupID == new Guid())
            {
                UserGroup.UserGroupID = UserGroupData.Insert(UserGroup);
                UserGroupBS.Add(UserGroup);
            }
            else
            {
                UserGroupData.Update(UserGroup);
                CurrentUserGroup = UserGroup;
            }

            grdUserGroup.Refetch();

            EnableItems(true);

            return(true);
        }
示例#2
0
        private static UserGroupData GetDataObjectFromReader(SqlDataReader dataReader)
        {
            UserGroupData data = new UserGroupData();

            if (dataReader.IsDBNull(dataReader.GetOrdinal("UserGroupId")))
            {
                data.UserGroupId = IdType.UNSET;
            }
            else
            {
                data.UserGroupId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("UserGroupId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("GroupId")))
            {
                data.GroupId = IdType.UNSET;
            }
            else
            {
                data.GroupId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("GroupId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("UserId")))
            {
                data.UserId = IdType.UNSET;
            }
            else
            {
                data.UserId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("UserId")));
            }

            return(data);
        }
示例#3
0
        public static IdType Insert(UserGroupData data)
        {
            // Create and execute the command
            string sql = "Insert Into " + TABLE + "("
                         + "GroupId,"
                         + "UserId,"
            ;

            sql = sql.Substring(0, sql.Length - 1) + ") values("
                  + "@GroupId,"
                  + "@UserId,"
            ;
            sql = sql.Substring(0, sql.Length - 1) + ");select Scope_Identity() Id";
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            cmd.Parameters.Add(new SqlParameter("@GroupId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "GroupId", DataRowVersion.Proposed, data.GroupId.DBValue));
            cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "UserId", DataRowVersion.Proposed, data.UserId.DBValue));

            // Execute the query
            SqlDataReader returnValue = cmd.ExecuteReader();

            returnValue.Read();
            int returnId = (int)(returnValue.GetDecimal(0));

            returnValue.Close();
            // Set the output paramter value(s)
            return(new IdType(returnId));
        }
示例#4
0
    /// <summary>
    /// Table USERS_GROUP
    /// </summary>
    /// <param name="dataInsert"></param>
    /// <returns></returns>
    public string insertUserGroup(UserGroupData dataInsert)
    {
        string response = "";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "";

        sql = "Insert Into USERS_GROUP (USERS_GROUP_ID, USERS_GROUP_NAME, USERS_GROUP_STATUS) Values ('" + dataInsert.Users_Group_Id + "','" + dataInsert.Users_Group_Name + "','" + dataInsert.Users_Group_Status + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
        }
        return(response);
    }
示例#5
0
        private bool CanSave()
        {
            if (txtUserGroupCode.Text == string.Empty)
            {
                EMessage.Show("کد گروه وارد نشده است", "خطا در ذخیره", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserGroupCode.Focus();
                return(false);
            }
            string Code = txtUserGroupCode.Text;

            if (UserGroupData.IsDuplicate(Code, new Guid(txtUserGroupCode.Tag.ToString())))
            {
                EMessage.Show("کد گروه تکراری است", "خطا در ذخیره", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserGroupCode.Focus();
                return(false);
            }

            if (txtUserGroupName.Text == string.Empty)
            {
                EMessage.Show("نام گروه وارد نشده است", "خطا در ذخیره", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserGroupName.Focus();
                return(false);
            }

            return(true);
        }
示例#6
0
 public UserGroupRecord(UserGroupData userGroup)
 {
     Id                = userGroup.Id;
     Name              = userGroup.Name;
     Role              = userGroup.Role;
     IsGameMaster      = userGroup.IsGameMaster;
     AvailableServers  = userGroup.Servers == null ? new List <int>() : userGroup.Servers.ToList();
     AvailableCommands = userGroup.Commands == null ? new List <string>() : userGroup.Commands.ToList();
 }
示例#7
0
        public void CheckAccounts()
        {
            IPCAccessor.Instance.Granted += accessor =>
            {
                WorldServer.Instance.IOTaskPool.ExecuteInContext(() =>
                {
                    IPCAccessor.Instance.SendRequest <AccountsAnswerMessage>(
                        new AccountsRequestMessage()
                    {
                        LoginLike = AccountName + "%"
                    }, x =>
                    {
                        if (x.Accounts != null)
                        {
                            foreach (var account in x.Accounts)
                            {
                                int id;
                                if (int.TryParse(account.Login.Remove(0, AccountName.Length), out id))
                                {
                                    m_fakeAccountsId.Add(id);
                                }
                            }
                        }
                    });

                    var usergroup = AccountManager.Instance.GetGroupOrDefault(FakeUserGroup);

                    if (usergroup == AccountManager.DefaultUserGroup)
                    {
                        var data = new UserGroupData()
                        {
                            Id           = FakeUserGroup,
                            Name         = "FakeClient",
                            IsGameMaster = true,
                            Role         = RoleEnum.Moderator,
                            Servers      = new[] { WorldServer.ServerInformation.Id },
                            Commands     = new string[0]
                        };

                        IPCAccessor.Instance.SendRequest <GroupAddResultMessage>(new GroupAddMessage(data), x =>
                        {
                            FakeUserGroup = x.UserGroup.Id;
                            AccountManager.Instance.AddUserGroup(new UserGroup(x.UserGroup));
                            Plugin.CurrentPlugin.Config.Save();
                        });
                    }
                });
            };
        }
示例#8
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            if (CurrentState != FormState.View)
            {
                if (!SaveUserGroup())
                {
                    return;
                }
            }

            CurrentState = FormState.Insert;
            EmptyFields();
            EnableItems(false);
            txtUserGroupCode.Text = UserGroupData.GetNewCode();
            FixAccDetailCode();
            txtUserGroupCode.Focus();
        }
示例#9
0
        public static UserGroupData Load(IdType userGroupId)
        {
            WhereClause w = new WhereClause();

            w.And("UserGroupId", userGroupId.DBValue);
            SqlDataReader dataReader = GetListReader(DatabaseEnum.ORDERDB, TABLE, w, null, true);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("Load found no rows for UserGroup.");
            }
            UserGroupData data = GetDataObjectFromReader(dataReader);

            dataReader.Close();
            return(data);
        }
示例#10
0
    /// <summary>
    /// Table USERS_GROUP
    /// </summary>
    /// <param name="User_Id"></param>
    /// <returns></returns>
    public UserGroupData getUserGroup(string Group_Id)
    {
        UserGroupData data = new UserGroupData();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        oracleObj.SelectCommand = "Select * From USERS_GROUP Where USERS_GROUP_ID='" + Group_Id + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            data.Users_Group_Id     = rowData["USERS_GROUP_ID"].ToString();
            data.Users_Group_Name   = rowData["USERS_GROUP_NAME"].ToString();
            data.Users_Group_Status = rowData["USERS_GROUP_STATUS"].ToString();
        }

        return(data);
    }
示例#11
0
    /// <summary>
    /// Table USERS_GROUP
    /// </summary>
    /// <param name="sql"></param>
    /// <returns></returns>
    public List <UserGroupData> getUserGroupManual(string sql)
    {
        List <UserGroupData> data = new List <UserGroupData>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            UserGroupData group = new UserGroupData();
            group.Users_Group_Id     = rowData["USERS_GROUP_ID"].ToString();
            group.Users_Group_Name   = rowData["USERS_GROUP_NAME"].ToString();
            group.Users_Group_Status = rowData["USERS_GROUP_STATUS"].ToString();
            data.Add(group);
        }

        return(data);
    }
示例#12
0
        public static void Update(UserGroupData data)
        {
            // Create and execute the command
            UserGroupData oldData = Load(data.UserGroupId);
            string        sql     = "Update " + TABLE + " set ";

            if (!oldData.GroupId.Equals(data.GroupId))
            {
                sql = sql + "GroupId=@GroupId,";
            }
            if (!oldData.UserId.Equals(data.UserId))
            {
                sql = sql + "UserId=@UserId,";
            }
            WhereClause w = new WhereClause();

            w.And("UserGroupId", data.UserGroupId.DBValue);
            sql = sql.Substring(0, sql.Length - 1) + w.FormatSql();
            SqlCommand cmd = GetSqlCommand(DatabaseEnum.ORDERDB, sql, CommandType.Text, COMMAND_TIMEOUT);

            //Create the parameters and append them to the command object
            if (!oldData.UserGroupId.Equals(data.UserGroupId))
            {
                cmd.Parameters.Add(new SqlParameter("@UserGroupId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "UserGroupId", DataRowVersion.Proposed, data.UserGroupId.DBValue));
            }
            if (!oldData.GroupId.Equals(data.GroupId))
            {
                cmd.Parameters.Add(new SqlParameter("@GroupId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "GroupId", DataRowVersion.Proposed, data.GroupId.DBValue));
            }
            if (!oldData.UserId.Equals(data.UserId))
            {
                cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "UserId", DataRowVersion.Proposed, data.UserId.DBValue));
            }

            // Execute the query
            if (cmd.Parameters.Count > 0)
            {
                cmd.ExecuteNonQuery();
            }
        }
示例#13
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (UserGroupBS.Count == 0)
            {
                return;
            }

            if (!CanDelete())
            {
                EMessage.Show("این آیتم بدلیل داشتن گردش، غیرقابل حذف می باشد", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (EMessage.Show("آیا انبار مورد نظر حذف گردد؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            UserGroupData.Delete(((UserGroupEntity)UserGroupBS.Current).UserGroupID);
            UserGroupBS.RemoveCurrent();

            UserGroupBS_PositionChanged(null, null);
        }
示例#14
0
        private void LoadTree_UserGroup()
        {
            List <UserGroupEntity> LstUserGroups = UserGroupData.SelectAll();

            tvGroupUser.Nodes.Clear();

            TreeNode TnRoot = new TreeNode();

            TnRoot.Text       = "[ریشه] گروه کاربران";
            TnRoot.Tag        = new Guid();
            TnRoot.ImageIndex = 0;
            tvGroupUser.Nodes.Add(TnRoot);

            foreach (UserGroupEntity item in LstUserGroups)
            {
                TreeNode TnUserGroups = new TreeNode();
                TnUserGroups.Text = "[" + item.UserGroupCode + "] " + item.UserGroupName;
                TnUserGroups.Tag  = item.UserGroupID;
                TnUserGroups.Expand();
                TnUserGroups.ImageIndex = 1;
                TnRoot.Nodes.Add(TnUserGroups);
            }
            CurrentState = FormState.View;
        }
示例#15
0
    /// <summary>
    /// Table USERS_GROUP
    /// </summary>
    /// <param name="updateData"></param>
    /// <returns></returns>
    public string updateUserGroup(UserGroupData updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "UPDATE USERS_GROUP SET USERS_GROUP_NAME = '" + updateData.Users_Group_Name + "', USERS_GROUP_STATUS = '" + updateData.Users_Group_Status + "' WHERE USERS_GROUP_ID = '" + updateData.Users_Group_Id + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }
示例#16
0
    private void Populate_AddPermissionsAdvancedGrid(UserGroupData data)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        string strMsg = "";

        if (_Base == "group")
        {
            strMsg = "<span class=\"cmsGroup\">" + _MessageHelper.GetMessage("generic cms group label") + "</span>";
        }
        else
        {
            strMsg = "<span class=\"cmsUser\">" + _MessageHelper.GetMessage("generic cms user label") + "</span>";
        }

        colBound.DataField = "TITLE";
        colBound.HeaderText = strMsg;
        colBound.HeaderStyle.CssClass = "title-header left";
        colBound.ItemStyle.CssClass = "left";
        PermissionsAdvancedGrid.Columns.Add(colBound);

        if (!(_IsBoard))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "COLLECTIONS";
            colBound.HeaderText = _MessageHelper.GetMessage("generic collection title");
            colBound.HeaderStyle.CssClass = "title-header center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsAdvancedGrid.Columns.Add(colBound);
        }
        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ADDFLD";
        if (_IsBoard)
        {
            colBound.HeaderText = "Add Forum";
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic add folders title");
        }
        colBound.HeaderStyle.CssClass = "title-header center";
        colBound.ItemStyle.CssClass = "center";
        PermissionsAdvancedGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "EDITFLD";
        if (_IsBoard)
        {
            colBound.HeaderText = "Edit Forum";
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic edit folders title");
        }
        colBound.HeaderStyle.CssClass = "title-header center";
        colBound.ItemStyle.CssClass = "center";
        PermissionsAdvancedGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DELETEFLD";
        if (_IsBoard)
        {
            colBound.HeaderText = "Delete Forum";
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic delete folders title");
        }
        colBound.HeaderStyle.CssClass = "title-header center";
        colBound.ItemStyle.CssClass = "center";
        PermissionsAdvancedGrid.Columns.Add(colBound);

        if (!(_IsBoard))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "TRAVERSE";
            colBound.HeaderText = _MessageHelper.GetMessage("generic traverse folder title");
            colBound.HeaderStyle.CssClass = "title-header center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsAdvancedGrid.Columns.Add(colBound);
        }

        SiteAPI m_refSiteApi = new SiteAPI();
        SettingsData setting_data = new SettingsData();
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);
        if (setting_data.EnablePreApproval)
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "ModifyPreapproval";
            colBound.HeaderText = "Modify Preapproval";
            colBound.HeaderStyle.CssClass = "title-header center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsAdvancedGrid.Columns.Add(colBound);
        }

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("COLLECTIONS", typeof(string)));
        dt.Columns.Add(new DataColumn("ADDFLD", typeof(string)));
        dt.Columns.Add(new DataColumn("EDITFLD", typeof(string)));
        dt.Columns.Add(new DataColumn("DELETEFLD", typeof(string)));
        dt.Columns.Add(new DataColumn("TRAVERSE", typeof(string)));
        if (setting_data.EnablePreApproval)
        {
            dt.Columns.Add(new DataColumn("ModifyPreapproval", typeof(string)));
        }
        bool bInherited = false;
        if (_ItemType == "folder")
        {
            bInherited = _FolderData.Inherited;
        }
        else
        {
            bInherited = _ContentData.IsInherited;
        }

        if (!(data == null))
        {
            dr = dt.NewRow();

            if (Request.QueryString["base"] == "group")
            {
                dr[0] = data.GroupDisplayName;
            }
            else
            {
                dr[0] = data.DisplayUserName;
            }

            dr[1] = "<input type=\"checkbox\"  id=\"frm_navigation\" name=\"frm_navigation\" ";
            dr[1] += "onclick=\"return CheckPermissionSettings(\'frm_navigation\');\" />";

            dr[2] = "<input type=\"checkbox\" id=\"frm_add_folders\"  name=\"frm_add_folders\" ";
            dr[2] += "onclick=\"return CheckPermissionSettings(\'frm_add_folders\');\" />";

            dr[3] = "<input type=\"checkbox\" id=\"frm_edit_folders\" name=\"frm_edit_folders\" ";
            dr[3] += "onclick=\"return CheckPermissionSettings(\'frm_edit_folders\');\" />";

            dr[4] = "<input type=\"checkbox\" id=\"frm_delete_folders\" name=\"frm_delete_folders\" ";
            dr[4] += "onclick=\"return CheckPermissionSettings(\'frm_delete_folders\');\" />";

            dr[5] = "<input type=\"checkbox\" id=\"frm_transverse_folder\" name=\"frm_transverse_folder\" checked=\"" + traverseFolder + "\"  ";
            dr[5] += "onclick=\"return CheckPermissionSettings(\'frm_transverse_folder\');\" />";

            if (setting_data.EnablePreApproval)
            {
                dr[6] = "<input type=\"checkbox\" id=\"frm_edit_preapproval\" name=\"frm_edit_preapproval\" ";
                dr[6] += "onclick=\"return CheckPermissionSettings(\'frm_edit_preapproval\');\" />";
            }
            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        PermissionsAdvancedGrid.DataSource = dv;
        PermissionsAdvancedGrid.DataBind();
    }
示例#17
0
    private void Populate_AddPermissionsGenericGrid(UserGroupData data)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        string strMsg = "";

        if (_Base == "group")
        {
            if (_IsMembership)
            {
                strMsg = "<span class=\"membershipGroup\">" + _MessageHelper.GetMessage("generic membership user group label") + "</span>";
            }
            else
            {
                strMsg = "<span class=\"cmsGroup\">" + _MessageHelper.GetMessage("generic cms group label") + "</span>";
            }

        }
        else
        {
            if (_IsMembership)
            {
                strMsg = "<span class=\"membershipUser\">" + _MessageHelper.GetMessage("generic membership user label") + "</span>";
            }
            else
            {
                strMsg = "<span class=\"cmsUser\">" + _MessageHelper.GetMessage("generic cms user label") + "</span>";
            }
        }

        colBound.DataField = "TITLE";
        colBound.HeaderStyle.CssClass = "title-header left";
        colBound.ItemStyle.CssClass = "left";
        colBound.HeaderText = strMsg;
        PermissionsGenericGrid.Columns.Add(colBound);
        colBound = new System.Web.UI.WebControls.BoundColumn();

        colBound.DataField = "READ";
        colBound.HeaderStyle.CssClass = "center";
        colBound.ItemStyle.CssClass = "center";
        colBound.HeaderText = _MessageHelper.GetMessage("generic read only");
        PermissionsGenericGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "EDIT";
        colBound.HeaderStyle.CssClass = "center";
        colBound.ItemStyle.CssClass = "center";
        if (_IsBoard)
        {
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Edit title") + " Topic");
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic Edit title");
        }
        PermissionsGenericGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ADD";
        colBound.HeaderStyle.CssClass = "center";
        colBound.ItemStyle.CssClass = "center";
        if (_IsBoard)
        {
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Add title") + " Topic");
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic Add title");
        }
        PermissionsGenericGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DELETE";
        colBound.HeaderStyle.CssClass = "center";
        colBound.ItemStyle.CssClass = "center";
        if (_IsBoard)
        {
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Delete title") + " Topic");
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic Delete title");
        }
        PermissionsGenericGrid.Columns.Add(colBound);

        if (!(_IsBoard))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "RESTORE";
            colBound.HeaderText = _MessageHelper.GetMessage("generic Restore title");
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);
        }
        if (_IsBoard)
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GREAD";
            colBound.HeaderText = _MessageHelper.GetMessage("lbl perm postreply");
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GADDFILE";
            colBound.HeaderText = _MessageHelper.GetMessage("lbl perm addimgfil");
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GADD";
            colBound.HeaderText = _MessageHelper.GetMessage("lbl perm moderate");
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);
        }
        else
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GREAD";
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Library title") + " " + _MessageHelper.GetMessage("generic read only"));
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GADD";
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Add title") + " " + _MessageHelper.GetMessage("generic Images"));
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GADDFILE";
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Add title") + " " + _MessageHelper.GetMessage("generic Files"));
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "GADDHYP";
            colBound.HeaderText = (string)(_MessageHelper.GetMessage("generic Add title") + " " + _MessageHelper.GetMessage("generic Hyperlinks"));
            colBound.HeaderStyle.CssClass = "title-header center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);

            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "OVERWRITELIB";
            colBound.HeaderText = _MessageHelper.GetMessage("overwrite library title");
            colBound.HeaderStyle.CssClass = "center";
            colBound.ItemStyle.CssClass = "center";
            PermissionsGenericGrid.Columns.Add(colBound);
        }

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("READ", typeof(string)));
        dt.Columns.Add(new DataColumn("EDIT", typeof(string)));
        dt.Columns.Add(new DataColumn("ADD", typeof(string)));
        dt.Columns.Add(new DataColumn("DELETE", typeof(string)));
        dt.Columns.Add(new DataColumn("RESTORE", typeof(string)));
        if (_IsBoard)
        {
            dt.Columns.Add(new DataColumn("GREAD", typeof(string)));
            dt.Columns.Add(new DataColumn("GADDFILE", typeof(string)));
            dt.Columns.Add(new DataColumn("GADD", typeof(string)));
        }
        else
        {
            dt.Columns.Add(new DataColumn("GREAD", typeof(string)));
            dt.Columns.Add(new DataColumn("GADD", typeof(string)));
            dt.Columns.Add(new DataColumn("GADDFILE", typeof(string)));
        }
        dt.Columns.Add(new DataColumn("GADDHYP", typeof(string)));
        dt.Columns.Add(new DataColumn("OVERWRITELIB", typeof(string)));
        if (!(data == null))
        {
            dr = dt.NewRow();

            if (Request.QueryString["base"] == "group")
            {
                dr[0] = data.GroupDisplayName;
            }
            else
            {
                dr[0] = data.DisplayUserName;
            }

            dr[1] = "<input type=\"checkbox\" name=\"frm_readonly\" ";
            if (_IsMembership)
            {
                dr[1] += " checked=\"checked\" onclick=\"return CheckReadOnlyForMembershipUser(\'frm_readonly\');\">";
            }
            else
            {
                dr[1] += " onclick=\"return CheckPermissionSettings(\'frm_readonly\');\" />";
            }

            dr[2] = "<input type=\"checkbox\" name=\"frm_edit\" ";
            if (_IsMembership && (!_FolderData.IsCommunityFolder) && !(_IsBlog))
            {
                dr[2] += " disabled=\"disabled\" ";
            }
            dr[2] += "  onclick=\"return CheckPermissionSettings(\'frm_edit\');\" />";

            dr[3] = "<input type=\"checkbox\" name=\"frm_add\" ";
            if (_IsMembership && (!_FolderData.IsCommunityFolder) && !(_IsBoard || _IsBlog))
            {
                dr[3] += " disabled=\"disabled\" ";
            }
            dr[3] += "onclick=\"return CheckPermissionSettings(\'frm_add\');\" />";

            dr[4] = "<input type=\"checkbox\" name=\"frm_delete\" ";
            if (_IsMembership && !(_IsBlog))
            {
                dr[4] += " disabled=\"disabled\" ";
            }
            dr[4] += "onclick=\"return CheckPermissionSettings(\'frm_delete\');\" />";

            dr[5] = "<input type=\"checkbox\" name=\"frm_restore\"  ";
            if (_IsMembership)
            {
                dr[5] += " disabled=\"disabled\" ";
            }
            dr[5] += "onclick=\"return CheckPermissionSettings(\'frm_restore\');\" />";

            dr[6] = "<input type=\"checkbox\" name=\"frm_libreadonly\" ";
            if ((_IsMembership) && !(_IsBoard || _IsBlog || _FolderData.IsCommunityFolder))
            {
                dr[6] += " checked=\"checked\" ";
            }
            dr[6] += "onclick=\"return CheckPermissionSettings(\'frm_libreadonly\');\" />";

            if (_IsBoard == true)
            {
                dr[7] = "<input type=\"checkbox\" name=\"frm_addfiles\" ";
                dr[7] += "onclick=\"return CheckPermissionSettings(\'frm_addfiles\');\" />";

                dr[8] = "<input type=\"checkbox\" name=\"frm_addimages\"  ";
                dr[8] += " onclick=\"return CheckPermissionSettings(\'frm_addimages\');\" />";
            }
            else
            {
                dr[7] = "<input type=\"checkbox\" name=\"frm_addimages\"  ";
                if (_IsMembership && !(_IsBlog || _FolderData.IsCommunityFolder))
                {
                    dr[7] += " disabled=\"disabled\" ";
                }
                dr[7] += " onclick=\"return CheckPermissionSettings(\'frm_addimages\');\" />";

                dr[8] = "<input type=\"checkbox\" name=\"frm_addfiles\" ";
                if (_IsMembership && !(_IsBlog || _FolderData.IsCommunityFolder))
                {
                    dr[8] += " disabled=\"disabled\" ";
                }
                dr[8] += "onclick=\"return CheckPermissionSettings(\'frm_addfiles\');\" />";
            }

            dr[9] = "<input type=\"checkbox\" name=\"frm_addhyperlinks\" ";
            if (_IsMembership)
            {
                dr[9] += " disabled=\"disabled\" ";
            }
            dr[9] += "onclick=\"return CheckPermissionSettings(\'frm_addhyperlinks\');\" />";

            dr[10] = "<input type=\"checkbox\" name=\"frm_overwritelib\" ";
            if (_IsMembership)
            {
                dr[10] += " disabled=\"disabled\" ";
            }
            dr[10] += "onclick=\"return CheckPermissionSettings(\'frm_overwritelib\');\" />";

            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        PermissionsGenericGrid.DataSource = dv;
        PermissionsGenericGrid.DataBind();
    }
示例#18
0
    public bool Display_ViewConfiguration()
    {
        m_refUserApi = new UserAPI();
            m_refSiteApi = new SiteAPI();
            AppImgPath = m_refUserApi.AppImgPath;
            AppName = m_refUserApi.AppName;
            RegisterResources();
            setting_data = m_refSiteApi.GetSiteVariables(m_refUserApi.UserId);
            mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1);
            group_data = m_refUserApi.GetUserGroupById(1);
            sync_data = m_refUserApi.GetADStatus();
            //domain_data = m_refUserApi.GetDomains(1, 0)
            AdValid = setting_data.AdValid; //CBool(siteVars("AdValid"))
            ViewToolBar();
            //VERSION
            versionNumber.InnerHtml = m_refMsg.GetMessage("version") + "&nbsp;" + m_refSiteApi.Version + "&nbsp;" + m_refSiteApi.ServicePack;
            //BUILD NUMBER
            buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>";

            licenseMessageContainer.Visible = false;
            if (!(AdValid))
            {
                TR_domaindetail.Visible = false;
                licenseMessageContainer.Visible = true;
                licenseMessage.InnerHtml = m_refMsg.GetMessage("entrprise license with AD required msg");
            }
            else
            {
                if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups))
                {
                    if (setting_data.ADAuthentication == 1)
                    {
                        ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>";
                    }
                    else
                    {
                        ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>";
                    }
                }
                else
                {sync.Visible  =false;

                }
                if (setting_data.IsAdInstalled)
                {
                    installed.InnerHtml = m_refMsg.GetMessage("active directory installed") + "&nbsp;";
                }
                else
                {
                    installed.InnerHtml = m_refMsg.GetMessage("active directory not installed") + "&nbsp;";
                }
                TD_flag.InnerHtml = m_refMsg.GetMessage("active directory authentication flag");
                if (setting_data.ADAuthentication == 1)
                {
                    TD_flagenabled.InnerHtml = m_refMsg.GetMessage("AD enabled");
                }
                else if (setting_data.ADAuthentication == 2)
                {
                    TD_flagenabled.InnerHtml = m_refMsg.GetMessage("LDAP enabled");
                }
                else
                {
                    TD_flagenabled.InnerHtml = m_refMsg.GetMessage("disabled");
                }
                TD_dirflag.InnerHtml = m_refMsg.GetMessage("active directory flag");
                if (setting_data.ADIntegration)
                {
                    TD_intflag.InnerHtml = m_refMsg.GetMessage("enabled");
                }
                else
                {
                    TD_intflag.InnerHtml = m_refMsg.GetMessage("disabled");
                }
                TD_autouser.InnerHtml = m_refMsg.GetMessage("auto add user flag");
                if (setting_data.ADAutoUserAdd)
                {
                    TD_autouserflag.InnerHtml = m_refMsg.GetMessage("enabled");
                }
                else
                {
                    TD_autouserflag.InnerHtml = m_refMsg.GetMessage("disabled");
                }

                lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header");
                autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type");
                if (setting_data.ADAutoUserAddType == Ektron.Cms.Common.EkEnumeration.AutoAddUserTypes.Member)
                {
                    autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl member");
                }
                else
                {
                    autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl author");
                }

                TD_autogroup.InnerHtml = m_refMsg.GetMessage("auto add user to group flag");

                if (setting_data.ADAutoUserToGroup)
                {
                    TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("enabled");
                }
                else
                {
                    TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("disabled");
                }
                userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping title");
                TD_cmstitle.InnerHtml = m_refMsg.GetMessage("cms property title");
                TD_dirproptitle.InnerHtml = m_refMsg.GetMessage("active directory property title");
                int i = 0;
                if (!(mapping_data == null))
                {
                    System.Text.StringBuilder result = new System.Text.StringBuilder();
                    for (i = 0; i <= mapping_data.Length - 1; i++)
                    {
                        result.Append("<tr>");
                        result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>");
                        result.Append("<td class=\"readOnlyValue\">" + mapping_data[i].AdName + "</td>");
                        result.Append("<tr>");
                    }
                    mapping_list.Text = result.ToString();
                }
                adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map");
                TD_grpnameval.InnerHtml = group_data.GroupName;
                TD_grpDomainVal.InnerHtml = group_data.GroupDomain;
                domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":";
                //If (domain_data.Length = 0) Then
                //domainValue.InnerHtml += "<font color=""red""><strong>" & m_refMsg.GetMessage("generic no domains found") & " " & m_refMsg.GetMessage("generic check ad config msg") & "</strong></font>"
                //Else
                if (setting_data.ADDomainName == "")
                {
                    domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption");
                }
                else if (setting_data.ADAuthentication == 2)
                {
                    domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption");
                }
                else
                {
                    domainValue.InnerHtml += setting_data.ADDomainName;
                }
                //End If
            }
            return false;
    }
示例#19
0
 private string GetUserOrGroupName(UserGroupData userGroupDataItem)
 {
     return (userGroupDataItem.GroupId != -1 ? userGroupDataItem.GroupName : userGroupDataItem.UserName);
 }
示例#20
0
 public void DisplayUsers()
 {
     TR_AddGroupDetail.Visible = false;
     if (Request.QueryString["OrderBy"] == "")
     {
         OrderBy = "UserName";
     }
     else
     {
         OrderBy = Request.QueryString["OrderBy"];
     }
     GroupRequest req = new GroupRequest();
     req.GroupType = m_intGroupType;
     req.GroupId = uId;
     req.SortOrder = OrderBy;
     req.SortDirection = m_strDirection;
     req.SearchText = m_strSearchText;
     req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
     req.CurrentPage = m_intCurrentPage;
     user_list = m_refUserApi.GetUsersNotInGroup(req);
     m_intTotalPages = req.TotalPages;
     group_data = m_refUserApi.GetUserGroupById(uId);
     AddUserToGroupToolBar();
     Populate_AddUserToGroupGrid();
 }
示例#21
0
    private void DisplayUsers()
    {
        UserRequestData req = new UserRequestData();
        if (Request.QueryString["OrderBy"] == "" || Request.QueryString["OrderBy"] == string.Empty || Request.QueryString["OrderBy"] == null)
        {
            OrderBy = "user_name";
        }
        else
        {
            OrderBy = Request.QueryString["OrderBy"];
        }
        if (m_intGroupId == 888888)
        {
            GroupName = "All_Members";
        }
        if (m_intGroupId != 888888 || m_intGroupId != 2)
        {
            usergroup_data = m_refUserApi.GetUserGroupById(m_intGroupId);
            if (!(usergroup_data == null))
            {
                GroupName = usergroup_data.GroupName;
            }
        }

        ltr_groupsubscription.Text = m_refUserApi.EkUserRef.IsGroupPartOfSubscriptionProduct(m_intGroupId).ToString().ToLower();

        m_intCurrentPage = System.Convert.ToInt32(this.uxPaging.SelectedPage);

        req.Type = System.Convert.ToInt32(m_intGroupType == 3 ? 0 : m_intGroupType);
        req.Group = m_intGroupId;
        req.RequiredFlag = m_intUserActiveFlag;
        req.OrderBy = OrderBy;
        req.OrderDirection = m_strDirection;
        req.SearchText = m_strSearchText;
        req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
        req.CurrentPage = m_intCurrentPage + 1;
        user_list = m_refUserApi.GetAllUsers(ref req);
        m_intTotalPages = req.TotalPages;
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);
        ViewAllUsersToolBar();
        if (this.m_bCommunityGroup)
        {
            Populate_ViewCommunityMembersGrid(user_list);
        }
        else
        {
            Populate_ViewAllUsersGrid(user_list);
        }
    }
示例#22
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     UserGroupBS.DataSource = UserGroupData.SelectAll();
 }
示例#23
0
    private UserGroupData[] GetSearchedUsers()
    {
        ValidatePermissions();

            List<UserData> userDataList;
            Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty> userCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty>();

            Ektron.Cms.Framework.Users.User userFrameworkApi = new Ektron.Cms.Framework.Users.User(Ektron.Cms.Framework.ApiAccessMode.Admin);
            int i = 0;
            int j = 0;
            int count = 0;
            UserGroupData[] userGroupData = null;
            int permissionUserType = System.Convert.ToInt32(_IsMembership ? ContentAPI.PermissionUserType.Membership : ContentAPI.PermissionUserType.Cms);
            Ektron.Cms.UserGroupData[] emptyUserGroupData = null;
            string assignedUser = (string) hdnAssignedUserGroupIds.Value;
            _AssignedUsers = assignedUser.Split(",".ToCharArray());
            //set paging size
            Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo();
            if (! this._IsSearch)
            {
                pageInfo.CurrentPage = _CurrentPage + 1;
                pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            }

            //_UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", permissionUserType, ContentAPI.PermissionRequestType.UnAssigned, pageInfo)

            userCriteria.PagingInfo = pageInfo;
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText);
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsMemberShip, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership);
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "internaladmin");
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "builtin");
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsDeleted, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, true);
            userDataList = userFrameworkApi.GetList(userCriteria);

            while (i < userDataList.Count)
            {
                for (j = 0; j <= _AssignedUsers.Length - 2; j++)
                {
                    if (Convert.ToInt64(_AssignedUsers[j]) == userDataList[i].Id)
                    {
                        userDataList.Remove(userDataList[i]);
                    }
                    if (userDataList.Count == 0)
                    {
                        goto endOfWhileLoop;
                    }
                }
                i++;
            }
        endOfWhileLoop:
            i = 0;
            if (userDataList.Count > 0)
            {
                if (userDataList.Count == 1)
                {
                    userGroupData = new UserGroupData[userDataList.Count + 1];
                }
                else
                {
                    userGroupData = new UserGroupData[userDataList.Count - 1 + 1];
                }
                //isAssignedUser = isAssigned(_UserGroupData, userDataList)
                //If (isAssignedUser = False) Then
                foreach (UserData user in userDataList)
                {
                    userGroupData[i] = new UserGroupData();
                    userGroupData[i].UserId = user.Id;
                    userGroupData[i].UserName = user.Username;
                    userGroupData[i].GroupId = -1;
                    userGroupData[i].IsMemberShipUser = user.IsMemberShip;
                    i++;
                }
                //End If
            }
            //Return IIf(userGroupDataItem.GroupId <> -1, userGroupDataItem.GroupId.ToString(), userGroupDataItem.UserId.ToString())
            if (userGroupData != null)
            {
                for (j = 0; j <= userGroupData.Length - 1; j++)
                {
                    if (userGroupData[j] == null)
                    {
                        count++;
                    }
                }
                if (count == userGroupData.Length)
                {
                    return emptyUserGroupData;
                }
                else
                {
                    return userGroupData;
                }
            }
            _TotalPages = pageInfo.TotalPages;

            return emptyUserGroupData;
    }
示例#24
0
 private string GetUserOrGroupIcon(UserGroupData userGroupDataItem)
 {
     bool isGroup = System.Convert.ToBoolean(userGroupDataItem.GroupId != -1 ? true : false);
         return this.ApplicationPath + "/images/ui/icons/" + (isGroup ? _GroupIcon : _UserIcon);
 }
示例#25
0
 private string GetUserOrGroupId(UserGroupData userGroupDataItem)
 {
     return (userGroupDataItem.GroupId != -1 ? (userGroupDataItem.GroupId.ToString()) : (userGroupDataItem.UserId.ToString()));
 }
示例#26
0
 private bool isAssigned(UserGroupData[] userGroupData, List<UserData> userDataList)
 {
     bool returnVal = true;
         foreach (UserGroupData userGroup in userGroupData)
         {
             foreach (UserData user in userDataList)
             {
                 if (userGroup.UserId == user.Id)
                 {
                     returnVal = false;
                 }
             }
         }
         return returnVal;
 }
示例#27
0
 private string GetUserOrGroupType(UserGroupData userGroupDataItem)
 {
     string type;
         type = (string) (userGroupDataItem.IsMemberShipUser ? "Membership " : "Cms ");
         type = (string) (userGroupDataItem.IsMemberShipGroup ? "Membership " : type);
         return (userGroupDataItem.GroupId != -1 ? type + "Group" : type + "User");
 }
示例#28
0
    private void Display_MapCMSUserGroupToAD()
    {
        AppImgPath = m_refSiteApi.AppImgPath;
        rp = Request.QueryString["rp"];
        e1 = Request.QueryString["e1"];
        e2 = Request.QueryString["e2"];
        f = Request.QueryString["f"];
        if (rp == "")
        {
            rp = Request.Form["rp"];
        }

        if (e1 == "")
        {
            e1 = Request.Form["e1"];
        }

        if (e2 == "")
        {
            e2 = Request.Form["e2"];
        }

        if (f == "")
        {
            f = Request.Form["f"];
        }
        language_data = m_refSiteApi.GetAllActiveLanguages();
        user_data = m_refUserApi.GetUserGroupById(m_intGroupId);

        if ((m_intGroupId == 1) && (Convert.ToInt32(rp) == 3))
        {
            domain_data = m_refUserApi.GetDomains(1, 0);
        }
        else
        {
            domain_data = m_refUserApi.GetDomains(0, 0);
        }

        security_data = m_refContentApi.LoadPermissions(0, "content", 0);
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);

        if ((search == "1") || (search == "2"))
        {

            if (search == "1")
            {
                strFilter = Request.Form["groupname"];
                Domain = Request.Form["domainname"];
            }
            else
            {
                strFilter = Request.QueryString["groupname"];
                Domain = Request.QueryString["domainname"];
            }
            if (Domain == "All Domains")
            {
                Domain = "";
            }
            GroupData[] adgroup_data;
            adgroup_data = m_refUserApi.GetAvailableADGroups(strFilter, Domain);
            //TOOLBAR
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar((string)(m_refMsg.GetMessage("search ad for cms group") + " \"" + user_data.GroupDisplayName + "\""));
            result.Append("<table><tr>");

            //if (Request.ServerVariables["HTTP_USER_AGENT"].ToString().IndexOf("MSIE") > -1) //defect 16045
            //{
            //    result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/back.png", "javascript:window.location.reload(false);", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            //}
            //else
            //{
            //}
            result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/back.png", "javascript:history.back(1);", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));

            if (rp != "1")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/cancel.png", "#", m_refMsg.GetMessage("generic Cancel"), m_refMsg.GetMessage("close title"), "onclick=\"top.close();\"", StyleHelper.SaveButtonCssClass, true));
            }

            if (!(adgroup_data == null))
            {
                if (rp == "1")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/save.png", "#", m_refMsg.GetMessage("alt update button text (associate group)"), m_refMsg.GetMessage("btn update"), "onclick=\"return SubmitForm(\'aduserinfo\', \'CheckRadio(1);\');\"", StyleHelper.SaveButtonCssClass, true));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/save.png", "#", m_refMsg.GetMessage("alt update button text (associate group)"), m_refMsg.GetMessage("btn update"), "onclick=\"return SubmitForm(\'aduserinfo\', \'CheckReturn(1);\');\"", StyleHelper.SaveButtonCssClass, true));
                }
            }
            result.Append(StyleHelper.ActionBarDivider);
            result.Append("<td>");
            result.Append(m_refStyle.GetHelpButton("Display_MapCMSUserGroupToAD", ""));
            result.Append("</td>");
            result.Append("</tr></table>");
            htmToolBar.InnerHtml = result.ToString();
            //Dim i As Integer = 0
            //If (Not (IsNothing(domain_data))) Then
            //    domainname.Items.Add(New ListItem(m_refMsg.GetMessage("all domain select caption"), ""))
            //    domainname.Items(0).Selected = True
            //    For i = 0 To domain_data.Length - 1
            //        domainname.Items.Add(New ListItem(domain_data(i).Name, domain_data(i).Name))
            //    Next
            //End If
            Populate_MapCMSGroupToADGrid(adgroup_data);
        }
        else
        {

            PostBackPage.Text = Utilities.SetPostBackPage((string)("users.aspx?Action=MapCMSUserGroupToAD&Search=1&LangType=" + ContentLanguage + "&rp=" + rp + "&e1=" + e1 + "&e2=" + e2 + "&f=" + f + "&grouptype=" + m_intGroupType + "&groupid=" + m_intGroupId));
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar((string)(m_refMsg.GetMessage("search ad for cms group") + " \"" + user_data.DisplayUserName + "\""));
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            result.Append("<table><tr>");
            if (rp != "1")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/cancel.png", "#", m_refMsg.GetMessage("generic Cancel"), m_refMsg.GetMessage("btn cancel"), "onclick=\"top.close();\""));
            }
            else
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "images/UI/Icons/back.png", "javascript:history.back(1);", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            result.Append("<td>");
            result.Append(m_refStyle.GetHelpButton("Display_MapCMSUserGroupToAD", ""));
            result.Append("</td>");
            result.Append("</tr></table>");
            htmToolBar.InnerHtml = result.ToString();
            Populate_MapCMSUserGroupToADGrid_Search(domain_data);
        }
    }
示例#29
0
 public GroupAddMessage(UserGroupData userGroup)
 {
     UserGroup = userGroup;
 }
示例#30
0
    private UserGroupData[] GetSearchedGroups()
    {
        ValidatePermissions();

            //set paging size
            Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo();
            System.Collections.Generic.List<Ektron.Cms.UserGroupData> groupList = new System.Collections.Generic.List<Ektron.Cms.UserGroupData>();
            int i = 0;
            int j;
            pageInfo.CurrentPage = _CurrentPage + 1;
            pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            UserGroupData[] userGroupData = null;

            Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty> userGroupCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty>();
            userGroupCriteria.PagingInfo = pageInfo;
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText);
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.IsMembershipGroup, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership);

            string assignedUser = (string) hdnAssignedUserGroupIds.Value;
            _AssignedUsers = assignedUser.Split(",".ToCharArray());
            groupList = _UserApi.GetUserGroupList(userGroupCriteria);

            if (groupList.Count > 0)
            {
                while (i < groupList.Count)
                {
                    for (j = 0; j <= _AssignedUsers.Length - 2; j++)
                    {
                        if (Convert.ToInt64(_AssignedUsers[j]) == groupList[i].GroupId)
                        {
                            groupList.Remove(groupList[i]);
                        }
                        if (groupList.Count == 0)
                        {
                            goto endOfWhileLoop;
                        }
                    }
                    i++;
                }
        endOfWhileLoop:
                if (groupList.Count == 1)
                {
                    userGroupData = new UserGroupData[groupList.Count + 1];
                }
                else
                {
                    userGroupData = new UserGroupData[groupList.Count - 1 + 1];
                }
                i = 0;

                //isAssignedUser = isAssigned(_UserGroupData, userDataList)
                //If (isAssignedUser = False) Then
                foreach (UserGroupData groupData in groupList)
                {
                    userGroupData[i] = new UserGroupData();
                    userGroupData[i].GroupId = groupData.GroupId;
                    userGroupData[i].GroupName = groupData.GroupName;
                    userGroupData[i].UserId = -1;
                    userGroupData[i].IsMemberShipUser = groupData.IsMemberShipGroup;
                    i++;
                }
                //End If
            }
            _TotalPages = pageInfo.TotalPages;
            return userGroupData;
    }
示例#31
0
 private string GetIsGroup(UserGroupData userGroupDataItem)
 {
     return (userGroupDataItem.GroupId != -1 ? "true" : "false");
 }
示例#32
0
 public UserGroup(UserGroupData data, UserGroupCommand[] commands)
 {
     this.m_data            = data;
     this.AvailableCommands = commands;
 }
示例#33
0
    private bool Display_EditConfiguration()
    {
        string[] arrOrg;
            string[] arrItem;
            long arrCount;
            string[] arrDomain;
            long arrCount2;
            string[] arrOrg2;
            bool isUnit = false;
            string[] arrServer;
            string[] arrLDAPDomain;
            string strLDAPDomain = "";
            string[] arrLDAPDomainElement;
            bool first = true;
            string adselectedstate = "";

            m_refUserApi = new UserAPI();
            m_refSiteApi = new SiteAPI();
            AppImgPath = m_refUserApi.AppImgPath;
            AppName = m_refUserApi.AppName;
            setting_data = m_refSiteApi.GetSiteVariables(-1);
            mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1);
            cGroup = m_refUserApi.GetUserGroupById(1);
            sync_data = m_refUserApi.GetADStatus();

            try
            {
                domain_data = m_refUserApi.GetDomains(1, 0);
            }
            catch
            {
                domain_data = null;
            }

            EditToolBar(); //POPULATE TOOL BAR
            //VERSION
            versionNumber.InnerHtml = m_refMsg.GetMessage("version") + "&nbsp;" + m_refSiteApi.Version + "&nbsp;" + m_refSiteApi.ServicePack;
            //BUILD NUMBER
            buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>";

            if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups))
            {
                if (setting_data.ADAuthentication == 1)
                {
                    ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>";
                }
                else
                {
                    ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>";
                }
            }
            //Ektron.Cms.Sync doesn't have "visible"
            //else
            //{
            //    Ektron.Cms.Sync.visible = false;
            //}

            if (setting_data.IsAdInstalled)
            {
                installed.InnerHtml = m_refMsg.GetMessage("active directory installed");
            }
            else
            {
                installed.InnerHtml = m_refMsg.GetMessage("active directory not installed");
            }

            if (setting_data.ADAuthentication == 1)
            {
                EnableADAuth.Checked = true;
                adselectedstate = "";
                //OrgUnitText.Disabled = True
                OrgText.Disabled = true;
                ServerText.Disabled = true;
                drp_LDAPtype.Enabled = false;
                PortText.Disabled = true;
                LDAPDomainText.Disabled = true;
                txtLDAPAttribute.Enabled = false;
                LDAP_SSL.Disabled = true;
                admingroupdomain.Disabled = false;
                admingroupname.Disabled = false;
                drpAutoAddType.Enabled = true;
            }
            else if (setting_data.ADAuthentication == 0)
            {
                DisableAD.Checked = true;
                adselectedstate = "disabled";
                //OrgUnitText.Disabled = True
                OrgText.Disabled = true;
                ServerText.Disabled = true;
                drp_LDAPtype.Enabled = false;
                PortText.Disabled = true;
                LDAPDomainText.Disabled = true;
                txtLDAPAttribute.Enabled = false;
                LDAP_SSL.Disabled = true;
                admingroupdomain.Disabled = true;
                admingroupname.Disabled = true;
            }
            else
            {
                EnableLDAP.Checked = true;
                adselectedstate = "disabled";
                //OrgUnitText.Disabled = False
                OrgText.Disabled = false;
                ServerText.Disabled = false;
                drp_LDAPtype.Enabled = true;
                PortText.Disabled = false;
                LDAPDomainText.Disabled = false;
                txtLDAPAttribute.Enabled = true;
                LDAP_SSL.Disabled = false;
                admingroupdomain.Disabled = true;
                admingroupname.Disabled = true;
            }

            lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header");
            autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type");
            drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl author"), "0"));
            drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl member"), "1"));
            drpAutoAddType.SelectedIndex = setting_data.ADAutoUserAddType.GetHashCode();

            if (setting_data.ADIntegration)
            {
                EnableADInt.Checked = true;
            }
            if (!(setting_data.ADAuthentication == 1))
            {
                EnableADInt.Disabled = true;
            }
            if (setting_data.ADAutoUserAdd)
            {
                EnableAutoUser.Checked = true;
            }
            if (!(setting_data.ADAuthentication == 1))
            {
                EnableAutoUser.Disabled = true;
            }
            //EnableAutoUserToGroup
            if (setting_data.ADAutoUserToGroup)
            {
                EnableAutoUserToGroup.Checked = true;
            }
            if (!(setting_data.ADAuthentication == 1))
            {
                EnableAutoUserToGroup.Disabled = true;
            }

            userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping");
            cmsProperty.InnerHtml = m_refMsg.GetMessage("cms property value");
            activeDirectoryProperty.InnerHtml = m_refMsg.GetMessage("active directory property value");
            userpropcount.Value = mapping_data.Length.ToString();

            int i;
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            if (!(mapping_data == null))
            {
                for (i = 0; i <= mapping_data.Length - 1; i++)
                {
                    result.Append("<tr>");
                    result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>");
                    result.Append("<td>");
                    result.Append("<input type=\"hidden\" maxlength=\"50\" size=\"50\" name=\"userpropname" + (i + 1) + "\"  id=\"userpropname" + (i + 1) + "\" value=\"" + mapping_data[i].CmsName + "\">");
                    result.Append("<input type=\"text\" maxlength=\"50\" size=\"25\" " + adselectedstate + " name=\"userpropvalue" + (i + 1) + "\" id=\"userpropvalue" + (i + 1) + "\" value=\"" + mapping_data[i].AdName + "\">");
                    result.Append("</td>");
                    result.Append("</tr>");
                }
                mapping_list.Text = result.ToString();
                result = null;
            }
            adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map");
            adGroupName.InnerHtml = m_refMsg.GetMessage("AD Group Name");
            adDomain.InnerHtml = m_refMsg.GetMessage("AD Domain");
            admingroupname.Value = cGroup.GroupName;
            admingroupdomain.Value = cGroup.GroupDomain;
            drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP AD"), "AD"));
            drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP NO"), "NO"));
            drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP SU"), "SU"));
            drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP OT"), "OT"));
            drp_LDAPtype.Attributes.Add("onchange", "javascript:CheckLDAP(\'\', true);");
            if (setting_data.ADAuthentication == 2)
            {
                if (setting_data.ADDomainName.IndexOf("&lt;/p&gt;") + 1 > 0) //defect 17813 - SMK
                {
                    setting_data.ADDomainName = setting_data.ADDomainName.Replace("&lt;", "<");
                    setting_data.ADDomainName = setting_data.ADDomainName.Replace("&gt;", ">");
                    setting_data.ADDomainName = setting_data.ADDomainName.Replace("&quot;", "\"");
                    setting_data.ADDomainName = setting_data.ADDomainName.Replace("&#39;", "\'");
                }
                LDAPSettingsData ldapsettings;
                ldapsettings = Ektron.Cms.Common.EkFunctions.GetLDAPSettings(setting_data.ADDomainName);

                /* From VB source
                arrDomain = Split(setting_data.ADDomainName, "</server>")
                arrServer = Split(arrDomain(0), "</p>")
                */

                string tempDomainName = setting_data.ADDomainName;
                tempDomainName = tempDomainName.Replace("</server>", "|").Replace("</p>", "^");
                arrDomain = tempDomainName.Split("|".ToCharArray());
                arrServer = arrDomain[0].ToString().Split("^".ToCharArray());

                ServerText.Value = ldapsettings.Server;
                PortText.Value = ldapsettings.Port.ToString();
                LDAPjs.Text += "<script language=\"javascript\" type=\"text/javascript\">" + Environment.NewLine;

                drp_LDAPtype.SelectedIndex = ldapsettings.ServerType.GetHashCode();
                LDAPjs.Text += "     CheckLDAP(\'" + drp_LDAPtype.Items[drp_LDAPtype.SelectedIndex].Value + "\', false);" + Environment.NewLine;
                LDAP_SSL.Checked = ldapsettings.EncryptionType == Ektron.Cms.Common.EkEnumeration.LDAPEncryptionType.SSL;
                txtLDAPAttribute.Text = ldapsettings.Attribute;
                if ((arrServer.Length - 1) > 1)
                {
                    // arrLDAPDomain = Split(arrServer(2), ",") VB Source
                    arrLDAPDomain = arrServer[2].Split(',');
                    for (arrCount = 0; arrCount <= (arrLDAPDomain.Length - 1); arrCount++)
                    {
                        arrLDAPDomainElement = arrLDAPDomain.GetValue(arrCount).ToString().Split('=');
                        if (arrLDAPDomainElement[0] == "dc")
                        {
                            if (!(strLDAPDomain == ""))
                            {
                                strLDAPDomain += ".";
                            }
                            strLDAPDomain += arrLDAPDomainElement[1];
                        }
                    }
                    LDAPDomainText.Value = strLDAPDomain;
                }

                arrOrg2 = arrDomain[1].Split(new string[] {"</>"}, StringSplitOptions.None);
                for (arrCount2 = 0; arrCount2 <= (arrOrg2.Length - 1); arrCount2++)
                {
                    //Response.Write(arrOrg2(arrCount2) & "<br/>")
                    if (!(arrOrg2.GetValue(arrCount2).ToString() == ""))
                    {
                        arrOrg = arrOrg2.GetValue(arrCount2).ToString().Split(',');
                        for (arrCount = 0; arrCount <= (arrOrg.Length - 1); arrCount++)
                        {
                            if (!(arrOrg.GetValue(arrCount).ToString() == ""))
                            {
                                //arrItem = Strings.Split(arrOrg(arrCount), "=", -1, 0);
                                arrItem = arrOrg.GetValue(arrCount).ToString().Split('=');
                                if ((arrItem[0].Trim() == "o") && arrCount2 == (arrOrg2.Length - 1))
                                {
                                    OrgText.Value = arrItem.GetValue(1).ToString();
                                    //ElseIf (arrItem(0) = "ou" Or arrItem(0) = " ou") Then
                                    //    If (Not first) Then
                                    //        OrgUnitText.Value &= ","
                                    //    End If
                                    //    OrgUnitText.Value &= "ou=" & arrItem(1)
                                    //    isUnit = True
                                    //    first = False
                                }
                                else
                                {
                                    if (! first)
                                    {
                                        OrgUnitText.Value += ",";
                                    }
                                    OrgUnitText.Value += arrOrg.GetValue(arrCount);
                                    isUnit = true;
                                    first = false;
                                }
                            }
                        }
                        if (isUnit)
                        {
                            OrgUnitText.Value += "</>";
                            isUnit = false;
                            first = true;
                        }
                    }
                }
            }
            if (domain_data == null)
            {
                searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>";
            }
            else if (domain_data.Length == 0)
            {
                searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>";
            }
            else
            {
                searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:DoSearch();\">" + m_refMsg.GetMessage("generic Search") + "</a>";
            }
            domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":";
            result = new System.Text.StringBuilder();
            result.Append("&nbsp;");

            if (domain_data == null && !m_refUserApi.RequestInformationRef.ADAdvancedConfig)
            {
                string selected = "";
                result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">");
                if (setting_data.ADDomainName == "")
                {
                    selected = " selected";
                }
                // Keep the "All Domains" drop down for continuity
                result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>");
                result.Append("</select>");
            }
            else if ((domain_data == null &&  m_refUserApi.RequestInformationRef.ADAdvancedConfig)
                    || domain_data.Length == 0)
            {
                result.Append("<font color=\"red\"><strong>" + m_refMsg.GetMessage("generic no domains found") + " " + m_refMsg.GetMessage("generic check ad config msg") + "</strong></font>");
            }
            else
            {
                if (m_refUserApi.RequestInformationRef.ADAdvancedConfig)
                {
                    for (i = 0; i <= domain_data.Length - 1; i++)
                    {
                        if (i > 0)
                            result.Append("&nbsp;");
                        result.Append(domain_data[i].Name).Append("<br/>");
                    }
                }
                else
                {
                    string selected = "";
                    result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">");
                    if (setting_data.ADDomainName == "")
                    {
                        selected = " selected";
                    }

                    result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>");
                    for (i = 0; i <= domain_data.Length - 1; i++)
                    {
                        if (domain_data[i].Name == setting_data.ADDomainName)
                        {
                            selected = " selected";
                        }
                        else
                        {
                            selected = "";
                        }
                        result.Append("<option value=\"" + domain_data[i].Name + "\"" + selected + ">" + domain_data[i].Name + "</option>");
                    }
                    result.Append("</select>");
                }
            }
            domainDropdown.InnerHtml = result.ToString();
            return false;
    }
示例#34
0
 public UserGroup(UserGroupData data)
 {
     m_data = data;
 }
示例#35
0
 private void Display_EditUserGroup()
 {
     uId = Convert.ToInt64(Request.QueryString["GroupID"]);
     group_data = m_refUserApi.GetUserGroupById(uId);
     EditUserGroupToolBar();
     UserGroupName.Value = Server.HtmlDecode(group_data.GroupName);
 }
示例#36
0
 private string GetUserOrGroupLink(UserGroupData userGroupDataItem)
 {
     string group = this.ApplicationPath + "/content.aspx?LangType=" + _ContentLanguage + "&action=AddPermissions&id=" + _Id + "&type=" + _ItemType + "&base=group&PermID=" + userGroupDataItem.GroupId + "&membership=" + _IsMembership.ToString();
         string user = this.ApplicationPath + "/content.aspx?LangType=" + _ContentLanguage + "&action=AddPermissions&id=" + _Id + "&type=" + _ItemType + "&base=user&PermID=" + userGroupDataItem.UserId + "&membership=" + _IsMembership.ToString();
         return (userGroupDataItem.GroupId != -1 ? group : user);
 }