Example #1
0
        /// <summary>
        /// Saves the current policy (usually after changed with Casbin API)
        /// back to file/database.
        /// </summary>
        public async Task SavePolicyAsync()
        {
            if (IsFiltered())
            {
                throw new Exception("cannot save a filtered policy");
            }
            await adapter.SavePolicyAsync(model);

            if (!(watcher is null))
            {
                await watcher?.UpdateAsync();
            }
        }
Example #2
0
        /// <summary>
        /// Saves the current policy (usually after changed with Casbin API)
        /// back to file/database.
        /// </summary>
        public async Task SavePolicyAsync()
        {
            if (IsFiltered())
            {
                throw new InvalidOperationException("Cannot save a filtered policy");
            }
            await adapter.SavePolicyAsync(model);

            if (watcher is not null)
            {
                await watcher.UpdateAsync();
            }
        }