Example #1
0
        protected virtual void CheckDataRight(IInputData input, DataRow row)
        {
            TkDebug.ThrowIfNoGlobalVariable();
            var args = new DataRightEventArgs(Context, BaseGlobalVariable.Current.UserInfo,
                                              MainResolver, input.Style, row);

            DataRight.Check(args);
        }
Example #2
0
        public void Check(DataRightEventArgs e)
        {
            if (e.User.UserId == null || e.User.MainOrgId == null)
            {
                throw new NoDataRightException(ErrorMessage);
            }

            string userId = e.Row[fField.NickName].ToString();

            if (userId != e.User.UserId.ToString())
            {
                string layer = GetLayer(e);
                string sql   = string.Format(ObjectUtil.SysCulture, USER_SQL, e.User.UserId, layer);
                int    count = DbUtil.ExecuteScalar(sql, e.Context).Value <int>();
                if (count != 1)
                {
                    throw new NoDataRightException(ErrorMessage);
                }
            }
        }