コード例 #1
0
        /// <summary>
        /// Set Table Security
        /// </summary>
        /// <param name="type"></param>
        /// <param name="create"></param>
        /// <param name="update"></param>
        /// <param name="delete"></param>
        /// <param name="query"></param>
        public static void SetTableSec(NancyContext context, string name, bool create, bool update, bool delete, bool query)
        {
            var setting = new
            {
                name   = name,
                create = new
                {
                    enable = create,
                },
                update = new
                {
                    enable = update,
                },
                delete = new
                {
                    enable = delete,
                },
                query = new
                {
                    enable = query
                }
            };

            var settingJObject = JObject.FromObject(setting);

            var sitesettings = context.GetSiteSettings();

            if (sitesettings.tablesec == null)
            {
                sitesettings.tablesec = new JObject();
            }

            sitesettings.tablesec[DataTypeFactory.NormalizeTypeName(name)] = settingJObject;

            AdminModule.WriteSiteSettings(context, sitesettings);
        }