コード例 #1
0
ファイル: SP_ChangePassword.cs プロジェクト: wj60387/hubble
        public void Run()
        {
            if (Parameters.Count != 2)
            {
                throw new ArgumentException("Parameter 1 is user name. Parameter 2 is password");
            }

            string userName = Parameters[0].Trim();

            if (userName == "")
            {
                throw new UserRightException("User name can't be empty!");
            }

            Service.ConnectionInformation connInfo = Service.CurrentConnection.ConnectionInfo;
            if (connInfo != null)
            {
                string curUserName = connInfo.UserName;

                if (!curUserName.Equals(userName, StringComparison.CurrentCultureIgnoreCase))
                {
                    Global.UserRightProvider.CanDo(Right.RightItem.ManageUser);
                }
            }

            Global.UserRightProvider.ChangePassword(userName, Parameters[1]);

            OutputMessage(string.Format("Create user account: {0} successul.", userName));
        }
コード例 #2
0
        public void Run()
        {
            if (Parameters.Count != 1)
            {
                throw new StoredProcException("First parameter is user name.");
            }

            string userName = Parameters[0].Trim();

            Service.ConnectionInformation connInfo = Service.CurrentConnection.ConnectionInfo;
            if (connInfo != null)
            {
                string curUserName = connInfo.UserName;

                if (!curUserName.Equals(userName, StringComparison.CurrentCultureIgnoreCase))
                {
                    Global.UserRightProvider.CanDo(Right.RightItem.ManageUser);
                }
            }

            AddColumn("Database");
            AddColumn("Right");

            foreach (DatabaseRight dbRight in Global.UserRightProvider.GetUserRights(userName))
            {
                NewRow();
                OutputValue("Database", dbRight.DatabaseName);
                OutputValue("Right", (int)dbRight.Right);
            }
        }
コード例 #3
0
        internal static void CanDo(string databaseName, RightItem right)
        {
            Service.ConnectionInformation connInfo = Service.CurrentConnection.ConnectionInfo;
            if (connInfo == null)
            {
                return;
            }

            string userName = connInfo.UserName;

            CanDo(databaseName, userName, right);
        }
コード例 #4
0
        public QueryResult Parse(Select select, Hubble.Core.Data.DBProvider dbProvider,
                                 Service.ConnectionInformation connInfo)
        {
            BigTable bigTable = dbProvider.BigTableCfg;

            //if (!string.IsNullOrEmpty(tc.ConnectString))
            //{
            //    throw new ParseException("Free version does not provider distributable BigTable. You should use HubblePro for it");
            //}

            if (bigTable.Tablets.Count <= 0)
            {
                throw new ParseException("The Bigtable must have at least one table in table collection");
            }

            List <Select> unionSelect = new List <Select>();

            foreach (TabletInfo tf in bigTable.Tablets)
            {
                string tableName = tf.TableName;
                Select sel       = select.Clone();
                sel.SelectFroms[0].Name  = tableName;
                sel.SelectFroms[0].Alias = tableName;

                unionSelect.Add(sel);
            }

            string      unionSelectTableName;
            string      tableTicksReturn = null;
            QueryResult datacacheQuery   = null;

            List <QueryResult> unionQueryResult = _SFQLParse.UnionSelectDistribute(connInfo, unionSelect,
                                                                                   out unionSelectTableName, out tableTicksReturn, out datacacheQuery);

            if (datacacheQuery != null)
            {
                return(datacacheQuery);
            }

            return(SFQLParse.ExcuteUnionSelect(unionSelectTableName, tableTicksReturn,
                                               unionQueryResult, connInfo));
        }