Skip to main content
Version: 8.1

Change access to web service for portal users

Level: advanced

The application has a set of base services and only internal users have access to them.

To change access to the base service:

  1. In the user-made package, create a service with the access settings for portal users.
  2. In the service, add the base service methods that must be available for portal users.
  3. Change the custom or extend the base client schemas by changing the call of base service to the call of the created service (see step 1).
  4. Compile the configuration.
Example

Change access to web service for portal users.

Example implementation

Example of the service source code that extends access to the ActivityUtilService base service:

PartnerActivityUtilService
namespace Terrasoft.Configuration
{
using System;
using System.IO;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using Terrasoft.Configuration.FileUpload;
using Terrasoft.Core.Factories;
using Terrasoft.Web.Common;
using Terrasoft.Web.Common.ServiceRouting;

[ServiceContract]
// The service is available for both: the internal and portal users
[DefaultServiceRoute]
[SspServiceRoute]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class PartnerActivityUtilService: BaseService {
// Base service, access needs to be extended
private static readonly ActivityUtilService _baseService = new ActivityUtilService();

[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public Guid CreateActivityFileEntity(JsonActivityFile jsonActivityFile) {
return _baseService.CreateActivityFileEntity(jsonActivityFile);
}
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public Guid CreateFileEntity(JsonEntityFile jsonEntityFile) {
return _baseService.CreateFileEntity(jsonEntityFile);
}
}
}