internal MockupService(Core core, Guid?userId, PluginContext pluginContext, MockupServiceSettings settings)
 {
     this.core          = core;
     this.pluginContext = pluginContext;
     this.userId        = userId.GetValueOrDefault();
     if (userId.HasValue && userId.Value != Guid.Empty)
     {
         userRef = new EntityReference("systemuser", userId.Value);
     }
     this.settings = settings;
 }
Example #2
0
        internal MockupService(Core core, Guid?userId, PluginContext pluginContext, MockupServiceSettings settings)
        {
            this.core          = core;
            this.pluginContext = pluginContext;
            if (userId.HasValue && userId.Value != Guid.Empty)
            {
                if (!core.ContainsEntity(new Entity(LogicalNames.SystemUser)
                {
                    Id = userId.Value
                }))
                {
                    throw new FaultException($"The userId '{userId.Value}' does not match a valid user");
                }

                userRef = new EntityReference("systemuser", userId.Value);
            }
            this.settings = settings;
        }
Example #3
0
        private void CheckBusinessUnitAttributes(Entity clonedEntity, MockupServiceSettings settings)
        {
            if (!clonedEntity.Attributes.ContainsKey("parentbusinessunitid"))
            {
                if (settings.ServiceRole == MockupServiceSettings.Role.UI)
                {
                    clonedEntity["parentbusinessunitid"] = metadata.RootBusinessUnit.ToEntityReference();
                }
                else
                {
                    throw new FaultException("Only one organization and one root business are allowed.");
                }
            }

            if (!clonedEntity.Attributes.ContainsKey("name"))
            {
                throw new FaultException("Business unit must have a name.");
                // The real error :  Condition for attribute 'businessunit.name': null is not a valid value for an attribute. Use 'Null' or 'NotNull' conditions instead.
            }
        }
Example #4
0
 /// <summary>
 /// Create an organization service, with the given settings, for the systemuser with the given id
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 public IOrganizationService CreateOrganizationService(Guid userId, MockupServiceSettings settings)
 {
     return(ServiceFactory.CreateOrganizationService(userId, settings));
 }
Example #5
0
 /// <summary>
 /// Gets a system administrator organization service, with the given settings
 /// </summary>
 /// <param name="Settings"></param>
 /// <returns></returns>
 public IOrganizationService GetAdminService(MockupServiceSettings Settings)
 {
     return(ServiceFactory.CreateAdminOrganizationService(Settings));
 }
 internal static void SetSettings(OrganizationRequest request, MockupServiceSettings settings)
 {
     request.Parameters[Key] = settings;
 }
 public MockupService(Core core, MockupServiceSettings settings) : this(core, null, null, settings)
 {
 }
Example #8
0
 public IOrganizationService CreateAdminOrganizationService(MockupServiceSettings settings)
 {
     return(new MockupService(core, null, this.pluginContext, settings));
 }
Example #9
0
 public IOrganizationService CreateOrganizationService(Guid?userId, MockupServiceSettings settings)
 {
     return(new MockupService(core, userId, this.pluginContext, settings));
 }