コード例 #1
0
ファイル: ConfigService.cs プロジェクト: aaronpowell/Plumber
        /// <summary>
        /// Update the stored workflow config for all content types
        /// </summary>
        /// <param name="model">Dictionary representing the indexed permissions for the content type</param>
        /// <returns>Bool representing success state</returns>
        public Task <bool> UpdateContentTypeConfigAsync(Dictionary <int, List <UserGroupPermissionsPoco> > model)
        {
            if (null == model || !model.Any())
            {
                return(Task.FromResult(false));
            }

            repo.DeleteContentTypeConfig();

            foreach (KeyValuePair <int, List <UserGroupPermissionsPoco> > permission in model)
            {
                if (!permission.Value.Any())
                {
                    continue;
                }
                foreach (UserGroupPermissionsPoco perm in permission.Value)
                {
                    repo.AddPermissionForContentType(perm);
                }
            }

            // emit event
            OnConfigUpdated(new OnConfigUpdatedEventArgs
            {
                Model     = model,
                UpdatedBy = Utility.GetCurrentUser()
            });

            return(Task.FromResult(true));
        }