LogObjects() public static méthode

public static LogObjects ( string msg, string ADobj, string portalObj ) : void
msg string
ADobj string
portalObj string
Résultat void
Exemple #1
0
        private void UpdatePortalFolderProperties(DirectoryEntry entry, Node node, SyncTree syncTree)
        {
            AdLog.LogObjects("Updating portal folder properties", entry.Path, node.Path);

            node.Name = Common.GetADObjectName(entry.Name);
            // node.Save() nem kell, később mentődik
        }
Exemple #2
0
        private void UpdatePortalDomainProperties(DirectoryEntry entry, Node node, SyncTree syncTree)
        {
            AdLog.LogObjects("Updating portal domain properties", entry.Path, node.Path);

            node.Name = GetADDomainName(entry);
            // node.Save() nem kell, később mentődik
        }
Exemple #3
0
        private void UpdatePortalUserProperties(DirectoryEntry entry, Node node, SyncTree syncTree)
        {
            AdLog.LogObjects("Updating portal user properties", entry.Path, node.Path);

            var user = (IUser)node;

            if (_config.SyncEnabledState)
            {
                user.Enabled = !Common.IsAccountDisabled(entry, _config.NovellSupport);
            }

            Common.UpdatePortalUserCustomProperties(entry, node, _propertyMappings, _config.SyncUserName);

            // node.Save() nem kell, később mentődik
        }
Exemple #4
0
        private void UpdatePortalGroupProperties(DirectoryEntry entry, Node node, SyncTree syncTree)
        {
            AdLog.LogObjects("Updating portal group properties", entry.Path, node.Path);

            node.Name = Common.GetADObjectName(entry.Name);

            // set members
            var group         = (Group)node;
            var portalMembers = group.Members;

            var adMembers     = GetADGroupMembers(entry, syncTree);
            var removeMembers = new List <Node>();

            // add new members:
            foreach (Guid guid in adMembers.Keys)
            {
                try
                {
                    //bool validResult;

                    //Node portalNode = GetNodeByGuid(guid, adMembers[guid].objType, out validResult);
                    //string adPath = adMembers[guid].Path;

                    //var portalNodePath = syncTree.GetPortalPath(adPath);
                    //portalNodePath = portalNodePath.Substring(0, portalNodePath.LastIndexOf('/'));
                    //portalNodePath = RepositoryPath.Combine(portalNodePath, adMembers[guid].SamAccountName);
                    //Node portalNode = Node.Load<Node>(portalNodePath);

                    Node   portalNode = null;
                    string guidStr    = guid.ToString();

                    if (_useOnTheFlyMemberQuery)
                    {
                        portalNode = Common.GetPortalObjectByGuid(guid);
                    }
                    else
                    {
                        switch (adMembers[guid].objType)
                        {
                        case ADObjectType.User:
                            portalNode = (_portalUsers.ContainsKey(guidStr)) ? Node.LoadNode(_portalUsers[guidStr]) : null;
                            break;

                        case ADObjectType.Group:
                            portalNode = (_portalGroups.ContainsKey(guidStr)) ? Node.LoadNode(_portalGroups[guidStr]) : null;
                            break;

                        default:
                            break;
                        }
                    }

                    if (portalNode != null)
                    {
                        if (!portalMembers.Any(n => n.Id == portalNode.Id))
                        {
                            switch (adMembers[guid].objType)
                            {
                            case ADObjectType.Group:
                                group.AddMember((IGroup)portalNode);
                                break;

                            case ADObjectType.User:
                                group.AddMember((IUser)portalNode);
                                break;

                            default:
                                // log: AD group membere se nem user, se nem group
                                AdLog.LogErrorObjects("Member is neither a user nor a group", adMembers[guid].Path, portalNode.Path);
                                break;
                            }
                        }
                    }
                    else
                    {
                        // log: a group a portálon nem létező user-t tartalmaz
                        // a synctree-k elvileg tartalmazzák, mert a GetADGroupMembers csak synctree által tartalmazott objektumokat ad vissza
                        AdLog.LogErrorADObject("Member does not exist in portal", adMembers[guid].Path);
                    }
                }
                catch
                {
                    AdLog.LogErrorADObject("Could not add member to group", adMembers[guid].Path);
                }
            }

            // remove old members
            // add nodes of portal group members to removeMembers list,
            // that have no corresponding AD objects in AD group
            foreach (Node member in portalMembers)
            {
                string guidStr = member["SyncGuid"] as string;
                if (guidStr != null)
                {
                    if (!adMembers.Keys.Contains(new Guid(guidStr)))
                    {
                        removeMembers.Add(member);
                    }
                }
                else
                {
                    // log: a portál csoport szinkronizálatlan objektumot is tartalmaz
                    AdLog.LogError(string.Format("Portal group contains unsynchronized object (group: {0}, object: {1}", group.Path, member.Path));
                }
            }

            // remove members from portal group
            foreach (Node member in removeMembers)
            {
                var portalUser = member as IUser;
                if (portalUser != null)
                {
                    group.RemoveMember(portalUser);
                }
                else
                {
                    var portalGroup = member as IGroup;
                    if (portalGroup != null)
                    {
                        group.RemoveMember(portalGroup);
                    }
                }
            }
            // node.Save() nem kell, később mentődik
        }