protected override void OnCreated(object sender, NodeEventArgs e) { base.OnCreated(sender, e); using (new SystemAccount()) { var parent = GroupMembershipObserver.GetFirstOrgUnitParent(e.SourceNode); if (parent != null) { SecurityHandler.AddUsersToGroup(parent.Id, new[] { e.SourceNode.Id }); } } }
/// <summary> /// After creation adds this group to the nearest parent <see cref="OrganizationalUnit"/> in the security graph as a member. /// Do not use this method directly from your code. /// </summary> protected override void OnCreated(object sender, NodeEventArgs e) { base.OnCreated(sender, e); // insert this orgunit to the security graph using (new SystemAccount()) { var parent = GroupMembershipObserver.GetFirstOrgUnitParent(this); if (parent != null) { Providers.Instance.SecurityHandler.AddGroupsToGroup(parent.Id, new[] { this.Id }); } } }
/// <summary> /// After creation adds this group to the nearest parent <see cref="OrganizationalUnit"/> as a member. /// Do not use this method directly from your code. /// </summary> protected override void OnCreated(object sender, NodeEventArgs e) { base.OnCreated(sender, e); // insert this group to the security graph using (new SystemAccount()) { var parent = GroupMembershipObserver.GetFirstOrgUnitParent(e.SourceNode); if (parent != null) { SecurityHandler.AddGroupsToGroup(parent.Id, new[] { e.SourceNode.Id }); } } var usersToAdd = GetMemberUsers().Select(u => u.Id).ToArray(); var groupsToAdd = GetMemberGroups().Select(g => g.Id).ToArray(); if (usersToAdd.Length > 0 || groupsToAdd.Length > 0) { SecurityHandler.AddMembers(this.Id, usersToAdd, groupsToAdd); } }