Ejemplo n.º 1
0
        private void AddComputerToToemsGroup(EntityComputer computer)
        {
            if (string.IsNullOrEmpty(ServiceSetting.GetSettingValue(SettingStrings.NewProvisionDefaultGroup)))
            {
                Logger.Debug("New Provision default group is not enabled.  Skipping");
                return;
            }

            var group = _groupService.GetGroupByName(ServiceSetting.GetSettingValue(SettingStrings.NewProvisionDefaultGroup));

            if (group == null)
            {
                return;
            }

            if (group.Type.Equals("Dynamic"))
            {
                return;
            }

            var groupMembership = new EntityGroupMembership();

            groupMembership.ComputerId = computer.Id;
            groupMembership.GroupId    = group.Id;
            _groupMemberships.Add(groupMembership);
            _groupMembershipService.AddMembership(_groupMemberships);
        }
Ejemplo n.º 2
0
        private void UpdateMemberships()
        {
            var ddComputers = _computerService.GetAllAdComputers();

            foreach (var computer in ddComputers)
            {
                var computerAdGroups = _computerService.GetComputerAdGroups(computer.Id);
                foreach (var adGroup in computerAdGroups)
                {
                    var membership =
                        _groupMemberships.FirstOrDefault(x => x.ComputerId == computer.Id && x.GroupId == adGroup.Id);
                    if (membership == null)
                    {
                        _groupMembershipService.DeleteByIds(computer.Id, adGroup.Id);
                    }
                }
            }
            _groupMembershipService.AddMembership(_groupMemberships);
        }
Ejemplo n.º 3
0
 public DtoActionResult Post(List <EntityGroupMembership> groupMemberships)
 {
     return(_groupMembershipServices.AddMembership(groupMemberships));
 }