コード例 #1
0
ファイル: ODataFacade.cs プロジェクト: maurbone/DocSuitePA
        public bool HasViewableRight(Guid idDocumentUnit, string username, string domain)
        {
            string       odataFilter   = $"/DocumentUnitService.HasViewableDocument(idDocumentUnit={idDocumentUnit},username='******',domain='{domain}')";
            IBaseAddress webApiAddress = DocSuiteContext.Current.CurrentTenant.WebApiClientConfig.Addresses.Single(x => x.AddressName.Eq(WebApiHttpClient.ODATA_ADDRESS_NAME));
            TenantEntityConfiguration documentUnitEndpoint = DocSuiteContext.Current.CurrentTenant.Entities.Single(x => x.Key.Eq(ODATA_DOCUMENTUNIT_ENDPOINT_NAME)).Value;

            HttpClientConfiguration customHttpConfiguration = new HttpClientConfiguration();

            customHttpConfiguration.Addresses.Add(webApiAddress);
            WebApiControllerEndpoint endpoint = new WebApiControllerEndpoint
            {
                AddressName    = webApiAddress.AddressName,
                ControllerName = documentUnitEndpoint.ODATAControllerName,
                EndpointName   = ODATA_DOCUMENTUNIT_ENDPOINT_NAME
            };

            customHttpConfiguration.EndPoints.Add(endpoint);

            ODataModel <bool> result = WebAPIImpersonatorFacade.ImpersonateRawRequest <DocumentUnitEntities.DocumentUnit, ODataModel <bool> >(WebAPIHelper, odataFilter, customHttpConfiguration);

            if (result != null)
            {
                return(result.Value);
            }
            else
            {
                FileLogger.Warn(LogName.FileLog, string.Concat("HasViewableRight -> Document unit con id ", idDocumentUnit, " non trovata."));
                return(false);
            }
        }
コード例 #2
0
        public UDSDto GetUDSSource(Data.Entity.UDS.UDSRepository udsRepository, string odataFilter)
        {
            string                   controllerName = Utils.GetWebAPIControllerName(udsRepository.Name);
            IBaseAddress             webApiAddress  = DocSuiteContext.Current.CurrentTenant.WebApiClientConfig.Addresses.FirstOrDefault(x => x.AddressName.Eq(UDS_ADDRESS_NAME));
            WebApiControllerEndpoint udsEndpoint    = new WebApiControllerEndpoint
            {
                AddressName    = UDS_ADDRESS_NAME,
                ControllerName = controllerName,
                EndpointName   = "UDSModel"
            };

            HttpClientConfiguration customHttpConfiguration = new HttpClientConfiguration();

            customHttpConfiguration.Addresses.Add(webApiAddress);
            customHttpConfiguration.EndPoints.Add(udsEndpoint);

            odataFilter = string.Concat("?", odataFilter, "&applySecurity='0'");
            string jsonSource = WebAPIImpersonatorFacade.ImpersonateRawRequest <UDSModel, string>(WebAPIHelper, odataFilter, customHttpConfiguration);

            if (string.IsNullOrEmpty(jsonSource))
            {
                return(null);
            }

            return(ReadUDSJson(jsonSource, udsRepository));
        }
コード例 #3
0
ファイル: ODataFacade.cs プロジェクト: maurbone/DocSuitePA
        public DomainUserModel domainUserModel()
        {
            string       odataFilter   = $"/DomainUserService.GetCurrentRights()";
            IBaseAddress webApiAddress = DocSuiteContext.Current.CurrentTenant.WebApiClientConfig.Addresses.Single(x => x.AddressName.Eq(WebApiHttpClient.ODATA_ADDRESS_NAME));
            TenantEntityConfiguration domainuserEndpoint = DocSuiteContext.Current.CurrentTenant.Entities.Single(x => x.Key.Eq(ODATA_DOMAINUSER_ENDPOINT_NAME)).Value;

            HttpClientConfiguration customHttpConfiguration = new HttpClientConfiguration();

            customHttpConfiguration.Addresses.Add(webApiAddress);
            WebApiControllerEndpoint endpoint = new WebApiControllerEndpoint
            {
                AddressName    = webApiAddress.AddressName,
                ControllerName = domainuserEndpoint.ODATAControllerName,
                EndpointName   = ODATA_DOMAINUSER_ENDPOINT_NAME
            };

            customHttpConfiguration.EndPoints.Add(endpoint);
            DomainUserModel result = WebAPIImpersonatorFacade.ImpersonateRawRequest <DomainUser, DomainUserModel>(WebAPIHelper, odataFilter, customHttpConfiguration);

            return(result);
        }
コード例 #4
0
ファイル: ODataFacade.cs プロジェクト: maurbone/DocSuitePA
        public bool HasCollaborationViewableRight(int idCollaboration)
        {
            string       odataFilter   = $"/CollaborationService.HasViewableRight(idCollaboration={idCollaboration})";
            IBaseAddress webApiAddress = DocSuiteContext.Current.CurrentTenant.WebApiClientConfig.Addresses.Single(x => x.AddressName.Eq(WebApiHttpClient.ODATA_ADDRESS_NAME));
            TenantEntityConfiguration collaborationEndpoint = DocSuiteContext.Current.CurrentTenant.Entities.Single(x => x.Key.Eq(ODATA_COLLABORATION_ENDPOINT_NAME)).Value;

            HttpClientConfiguration customHttpConfiguration = new HttpClientConfiguration();

            customHttpConfiguration.Addresses.Add(webApiAddress);
            WebApiControllerEndpoint endpoint = new WebApiControllerEndpoint
            {
                AddressName    = webApiAddress.AddressName,
                ControllerName = collaborationEndpoint.ODATAControllerName,
                EndpointName   = ODATA_COLLABORATION_ENDPOINT_NAME
            };

            customHttpConfiguration.EndPoints.Add(endpoint);

            ODataModel <bool> result = WebAPIImpersonatorFacade.ImpersonateRawRequest <Collaboration, ODataModel <bool> >(WebAPIHelper, odataFilter, customHttpConfiguration);

            return(result.Value);
        }
コード例 #5
0
ファイル: ODataFacade.cs プロジェクト: maurbone/DocSuitePA
        public bool HasProcedureDistributionInsertRight(int idCategory)
        {
            string       odataFilter   = $"/FascicleService.HasProcedureDistributionInsertRight(idCategory={idCategory})";
            IBaseAddress webApiAddress = DocSuiteContext.Current.CurrentTenant.WebApiClientConfig.Addresses.Single(x => x.AddressName.Eq(WebApiHttpClient.ODATA_ADDRESS_NAME));
            TenantEntityConfiguration fascicleEndpoint = DocSuiteContext.Current.CurrentTenant.Entities.Single(x => x.Key.Eq(ODATA_FASCICLE_ENDPOINT_NAME)).Value;

            HttpClientConfiguration customHttpConfiguration = new HttpClientConfiguration();

            customHttpConfiguration.Addresses.Add(webApiAddress);
            WebApiControllerEndpoint endpoint = new WebApiControllerEndpoint
            {
                AddressName    = webApiAddress.AddressName,
                ControllerName = fascicleEndpoint.ODATAControllerName,
                EndpointName   = ODATA_FASCICLE_ENDPOINT_NAME
            };

            customHttpConfiguration.EndPoints.Add(endpoint);

            ODataModel <bool> result = WebAPIImpersonatorFacade.ImpersonateRawRequest <Fascicle, ODataModel <bool> >(WebAPIHelper, odataFilter, customHttpConfiguration);

            return(result.Value);
        }