private void ProcessRoleInheritance(object modelHost, SPSecurableObject securableObject, ResetRoleInheritanceDefinition breakRoleInheritanceModel) { InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = securableObject, ObjectType = typeof(SPSecurableObject), ObjectDefinition = breakRoleInheritanceModel, ModelHost = modelHost }); if (securableObject.HasUniqueRoleAssignments) { TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "HasUniqueRoleAssignments is TRUE. Resetting role inheritance", null); securableObject.ResetRoleInheritance(); } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = securableObject, ObjectType = typeof(SPSecurableObject), ObjectDefinition = breakRoleInheritanceModel, ModelHost = modelHost }); }
private void ProcessRoleInheritance(object modelHost, SecurableObject securableObject, ResetRoleInheritanceDefinition breakRoleInheritanceModel) { var context = securableObject.Context; InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = securableObject, ObjectType = typeof(SecurableObject), ObjectDefinition = breakRoleInheritanceModel, ModelHost = modelHost }); if (!securableObject.IsObjectPropertyInstantiated("HasUniqueRoleAssignments")) { context.Load(securableObject, s => s.HasUniqueRoleAssignments); context.ExecuteQueryWithTrace(); } if (securableObject.HasUniqueRoleAssignments) { TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "HasUniqueRoleAssignments is TRUE. Resetting role inheritance", null); securableObject.ResetRoleInheritance(); context.ExecuteQueryWithTrace(); } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = securableObject, ObjectType = typeof(SecurableObject), ObjectDefinition = breakRoleInheritanceModel, ModelHost = modelHost }); }
public static TModelNode AddResetRoleInheritance <TModelNode>(this TModelNode model, ResetRoleInheritanceDefinition definition, Action <TModelNode> action) where TModelNode : ModelNode, ISecurableObjectHostModelNode, new() { return(model.AddTypedDefinitionNode(definition, action)); }
public static TModelNode AddResetRoleInheritance <TModelNode>(this TModelNode model, ResetRoleInheritanceDefinition definition) where TModelNode : ModelNode, ISecurableObjectHostModelNode, new() { return(AddResetRoleInheritance(model, definition, null)); }
public static ModelNode AddResetRoleInheritance(this ModelNode model, ResetRoleInheritanceDefinition definition, Action <ModelNode> action) { return(model.AddDefinitionNode(definition, action)); }
public static ModelNode AddResetRoleInheritance(this ModelNode model, ResetRoleInheritanceDefinition definition) { return(AddResetRoleInheritance(model, definition, null)); }