Symfony2: Scope Widening Exception - service

I want to inject a form and formHandler service into my controller.
<services>
<service id="acme_core.image_controller" class="Acme\CoreBundle\Controller\ImageController">
<argument type="service" id="session" />
<argument type="service" id="acme_core.image.form" />
<argument type="service" id="acme_core.image.form.handler" />
<argument type="service" id="acme_core.image_manager.default" />
</service>
</services>
Scope Widening Injection detected: The definition "acme_core.image_controller" references the service "acme_core.image.form.handler" which belongs to a narrower scope. Generally, it is safer to either move "acme_core.image_controller" to scope "request" or alternatively rely on the provider pattern by injecting the container itself, and requesting the service "acme_core.image.form.handler" each time it is needed. In rare, special cases however that might not be necessary, then you can set the reference to strict=false to get rid of this error.
What does this mean concret?
What should I add tom my image_controller.xml?
Best Regards

You have to add scope="request" in your service tag e.g
<service id="acme_core.image_controller" class="Acme\CoreBundle\Controller\ImageController" scope="request">
For more info check this cookbook entry.

Related

How to pass and validate the signInEmail claim during External IDP login using Azure B2C custom policy?

This question is related to this one.
What we'd like to do is: at the moment the user clicks the button like Facebook OR Microsoft account OR Corporate AD in the Sign in page, call a validation technical profile to validate the email address the user is using to sign in.
I tried adding an OrchestrationStep like this:
<OrchestrationStep Order="4"
Type="ClaimsExchange">
<Preconditions>
<Precondition Type="ClaimEquals"
ExecuteActionsIf="false">
<Value>idp</Value>
<Value>CorporateAD</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>
<ClaimsExchanges>
<ClaimsExchange Id="FetchMoreClaimsExchange"
TechnicalProfileReferenceId="REST-ValidateSignInEmail" />
</ClaimsExchanges>
</OrchestrationStep>
This is actually calling REST-ValidateSignInEmail because I see an error returned in the URL like this:
https://mywebsite.azurewebsites.net/#error=server_error&error_description=AADB2C%3a++is+disabled.%0d%0aCorrelation+ID%3a+bce3fd82-1111-4f17-ad99-ef7770ed8dda%0d%0aTimestamp%3a+2019-11-08+20%3a34%3a51Z%0d%0a&state=7b7c70e7-7a77-77d7-7d7e-7dd0e7b707e7
The message is+disabled is coming from the REST API I put together but this obviously tells me that the email\signInEmail claim it expects as a parameter is not being sent\passed.
This is the Technical Profile:
<TechnicalProfile Id="REST-ValidateSignInEmail">
<DisplayName>Validate Email</DisplayName>
<Protocol Name="Proprietary"
Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">{Settings:AzureAppServiceUrl}/api/B2C/ValidateSignInEmail</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="SendClaimsIn">Body</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="signInName"
PartnerClaimType="UserEmail" />
</InputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
Can you shed some light on how to approach this?
Generally after I post the question I keep fiddling with the code.
Got it working like this:
<TechnicalProfile Id="REST-ValidateSignInEmail">
<DisplayName>Validate Email</DisplayName>
<Protocol Name="Proprietary"
Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">{Settings:AzureAppServiceUrl}/api/B2C/ValidateSignInEmail</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="SendClaimsIn">Body</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="signInName"
PartnerClaimType="UserEmail" />
</InputClaims>
<InputClaim ClaimTypeReferenceId="email"
PartnerClaimType="UserEmail" />
</InputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
Note that I added a new InputClaim with ClaimTypeReferenceId="email". email is the claim value that is passed when using an external IDP.
This sample policy showed me that I could add the OrchestrationStep right before the JwtIssuer one. We can also have it without any preconditions like this:
<OrchestrationStep Order="7"
Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="REST-ValidateSignInEmail"
TechnicalProfileReferenceId="REST-ValidateSignInEmail" />
</ClaimsExchanges>
</OrchestrationStep>
Doing so it'll get called for all IDPs.
Azure Active Directory B2C: Custom CIAM User Journeys

Title element doesn't work with Action Element in Manifest XML

I am creating an add-in for Microsoft Word.
I am getting manifest validation error for Title element inside Action element.
Microsoft Reference documentation for Action Element
Error #1:
XML Schema Violation: Your manifest does not adhere to the current set of XML schema definitions for Office Add-in manifests. (link: https://aka.ms/add-in-manifest-schema-violation)
- Details: The element 'Action' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides' has invalid child element 'Title' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides'. List of possible elements expected: 'TaskpaneId, SourceLocation' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides'.
- Line: 54
- Column: 22
Example:
<Action xsi:type="ShowTaskpane">
<Title resid="Contoso.Taskpane.Title" /> --> //Adding this line throws error
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Contoso.Taskpane.Url" />
</Action>
Could someone help me here?
The validator checks the order in which the XML elements appear.
Please use the code below:
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Contoso.Taskpane.Url" />
<Title resid="Contoso.Taskpane.Title" /> -->
</Action>

Access 2013 form not updating when navigation button pressed

First time on site. Forgive me, I'm probably doing this wrong, but I have searched for 2 days and not found my answer.
After entering data in the Lead Maintenance form, clicking the Registrar tab runs the following macro:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application">
<UserInterfaceMacro For="navbtnRegistrar" Event="OnClick">
<Statements>
<Action Name="SetWarnings"/>
<Action Collapsed="true" Name="OpenQuery">
<Argument Name="QueryName">qryEnroll</Argument>
</Action>
<Action Name="OpenQuery">
<Argument Name="QueryName">qryLeadMainUpdateEnrollToTrue</Argument>
</Action>
<Action Name="SetWarnings">
<Argument Name="WarningsOn">Yes</Argument>
</Action>
<Action Name="OpenForm">
<Argument Name="FormName">frmStudentsData</Argument>
</Action>
<Action Name="CloseWindow">
<Argument Name="ObjectType">Form</Argument>
<Argument Name="ObjectName">frmStudentsData</Argument>
<Argument Name="Save">No</Argument>
</Action>
</Statements>
</UserInterfaceMacro>
</UserInterfaceMacros>
The new data is being appended to the table properly, however the New Student data form is not displaying the appended data. Any suggestions?
It looks like your Student Data Entry form is in "Data Entry" mode, so it will automatically only show a blank record for your users to fill out. You would need to turn off Data Entry mode, a property on the form itself and turn on the navigation bar that you already have on the Lead Maintenance form so that users can navigate between records.

How to add widget to layout in Magento 2?

Is there a way to add widget to the layout xml? I know about the layout updates from the backend, but I wanted to know if there is a way to add widgets the same way as static blocks?
you can add widget via followings xml ,
<referenceContainer name="content.top">
<block class="Magento\Catalog\Block\Category\Widget\Link" name="demoBlock" template="widget/static_block/default.phtml">
<action method="setData">
<argument name="id_path" xsi:type="string">category/20</argument>
<argument name="title" xsi:type="string">Demo Category Title</argument>
<argument name="template" xsi:type="string">category/widget/link/link_inline.phtml</argument>
</action>
</block>
</referenceContainer>
you need to update followings
referenceContainer as per you needs
Block Class & Template (if you require to update the template for block)
arguments in setData

Mybatis Generator's bug: configuration items should be ordered?

If I put "<commentGenerator>" after "<jdbcConnection>", MBG proposed an error that context content should match: blablabla...
But when I put "<commentGenerator>" before "<jdbcConnection>", everything is ok. Here I have something to complain to the official website that if the order of these items is need, why you do not tell us! What an important thing! You r kidding the freshmen. Maybe it is some where I do not know, but this is a key point to build the MBG's configuration file successfully, why not put this NOTE on the top of the tutorial or somewhere eye-catching?
<generatorConfiguration >
<classPathEntry location="D:\mariadb-java-client-1.1.7.jar" />
<context id="db" >
<commentGenerator>
<property name="suppressAllComments" value="true" />
<property name="suppressDate" value="true" />
</commentGenerator>
<jdbcConnection driverClass="org.mariadb.jdbc.Driver"
connectionURL="jdbc:mariadb://localhost:3306/dbname"
userId="root"
password="password"
/>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- Model Class -->
<javaModelGenerator targetPackage="org.infrastructure.model" targetProject="infrastructure\src\main\java">
<property name="enableSubPackages" value="false" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- XML Files -->
<sqlMapGenerator targetPackage="sqlMap" targetProject="infrastructure\src\main\config">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- DAO -->
<javaClientGenerator type="XMLMAPPER" targetPackage="org.infrastructure.dao" targetProject="infrastructure\src\main\java">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- Tables -->
<table tableName="user" domainObjectName="User" ></table>
</context>
</generatorConfiguration>
First of all, in your xml configuration file, it doesn't contains a valid root element, which always should be like <!DOCTYPE .../>. About how to add a correct root element of mybatis generator configuration file, please see example from MyBatis GeneratorXML Configuration File Reference.
If you correctly specified root element such as following:
<!DOCTYPE generatorConfiguration PUBLIC
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"
>
This root element contains a typical DTD declaration located at http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd. This is the definition of the order of these items is need. And we are going to see what it looks like.
From line 47 of this document type definition, it defines element named context. The content is as following:
<!--
The context element is used to describe a context for generating files, and the source tables.
-->
<!ELEMENT context (property*, plugin*, commentGenerator?, jdbcConnection, javaTypeResolver?,javaModelGenerator, sqlMapGenerator?, javaClientGenerator?, table+)>
Which obviously defined the order of the element in context, that is:
property*, plugin*, commentGenerator?, jdbcConnection,
javaTypeResolver?,javaModelGenerator, sqlMapGenerator?,
javaClientGenerator?, table+
In this element, all children must occurs as following rules:
+ for specifying that there must be one or more occurrences of the item — the effective content of each occurrence may be different;
* for specifying that any number (zero or more) of occurrences is allowed — the item is optional and the effective content of each occurrence may be different;
? for specifying that there must not be more than one occurrence — the item is optional;
If there is no quantifier, the specified item must occur exactly one time at the specified position in the content of the element.
After we understanding its real meaning, why you could not change the order of commentGenerator and jdbcConnection should be clear.
Maybe you want to know how to make the element out of order, question How to define DTD without strict element order could be useful.
Wish it helpful.