Esempio n. 1
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            ADGroup adgroup = (ADGroup)dataObject;

            if (null != adgroup.ForeignGroupSid)
            {
                adgroup.LinkedGroup = SecurityPrincipalIdParameter.GetFriendlyUserName(adgroup.ForeignGroupSid, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                adgroup.ResetChangeTracking();
            }
            RoleGroup roleGroup = RoleGroupCommon.PopulateRoleAssignmentsAndConvert(adgroup, this.ConfigurationSession);

            roleGroup.PopulateCapabilitiesProperty();
            return(roleGroup);
        }
Esempio n. 2
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADGroup adgroup = (ADGroup)base.PrepareDataObject();

            if (!this.BypassSecurityGroupManagerCheck)
            {
                ADObjectId user;
                base.TryGetExecutingUserId(out user);
                RoleGroupCommon.ValidateExecutingUserHasGroupManagementRights(user, adgroup, base.ExchangeRunspaceConfig, new Task.ErrorLoggerDelegate(base.WriteError));
            }
            if ("crossforest" == base.ParameterSetName && adgroup.RoleGroupType == RoleGroupType.Standard)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorCannotChangeRoleGroupType), (ErrorCategory)1000, null);
            }
            if ("ExchangeDatacenterCrossForestParameterSet" == base.ParameterSetName)
            {
                if (Datacenter.ExchangeSku.ExchangeDatacenter != Datacenter.GetExchangeSku() && Datacenter.ExchangeSku.DatacenterDedicated != Datacenter.GetExchangeSku())
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorLinkedSidParameterNotAllowed(RoleGroupParameters.ParameterLinkedForeignGroupSid)), (ErrorCategory)1000, null);
                }
                this.linkedGroupSid = this.LinkedForeignGroupSid;
            }
            if ("crossforest" == base.ParameterSetName || "ExchangeDatacenterCrossForestParameterSet" == base.ParameterSetName)
            {
                adgroup.ForeignGroupSid = this.linkedGroupSid;
                if (adgroup.Members.Count > 0)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorLinkedRoleGroupCannotHaveMembers), (ErrorCategory)1000, null);
                }
            }
            if (base.Fields.IsModified("DisplayName"))
            {
                adgroup[RoleGroupSchema.DisplayName] = this.DisplayName;
            }
            this.roleGroup = RoleGroupCommon.PopulateRoleAssignmentsAndConvert(adgroup, this.ConfigurationSession);
            if (base.Fields.IsModified("Description"))
            {
                adgroup[ADGroupSchema.RoleGroupDescription] = (string.IsNullOrEmpty(this.Description) ? null : this.Description);
            }
            if (this.ExternalDirectoryObjectId != Guid.Empty)
            {
                adgroup.ExternalDirectoryObjectId = this.ExternalDirectoryObjectId.ToString();
            }
            TaskLogger.LogExit();
            return(adgroup);
        }