private string GetRoleDefinitionCreator(ClientContext ctx, string title, AppManifestBase manifest)
        {
            OnVerboseNotify("Getting role definition for " + title);

            var builder = new RoleDefinitionCreatorBuilder();

            builder.VerboseNotify += builder_Notify;
            if (manifest == null)
            {
                return(builder.GetRoleDefinitionCreator(ctx, title));
            }
            builder.GetRoleDefinitionCreator(ctx, title, manifest);
            return(string.Empty);
        }
示例#2
0
        private void GetRoleDefinitionDifferences(WebCreator webDefinition)
        {
            OnVerboseNotify("Processing role definitions");
            _sourceContext.Web.EnsureProperties(w => w.RoleDefinitions);
            _baseContext.Web.EnsureProperties(w => w.RoleDefinitions);
            var roleDefinitionCreatorBuilder = new RoleDefinitionCreatorBuilder();

            roleDefinitionCreatorBuilder.VerboseNotify += (sender, args) => OnVerboseNotify(args.Message);

            var roleDefinitionsToAdd =
                _sourceContext.Web.RoleDefinitions.Where(
                    rd => _baseContext.Web.RoleDefinitions.FirstOrDefault(brd => brd.Name == rd.Name) == null);

            foreach (var roleDefinition in roleDefinitionsToAdd)
            {
                roleDefinitionCreatorBuilder.GetRoleDefinitionCreator(_sourceContext, roleDefinition.Name,
                                                                      webDefinition.AppManifest);
            }
        }