0

I have a product database extension. Based on Extbase + Fluid. Everything working like it should be, but I have a Problem with restricted Access.

There are some products only for a certain group of users. When I set a group, and somebody uses a direkt link to this product, the login site should come in case of no login.

It is working for sites, but with products I get the:

"The value must be of type "xx", but was of type "NULL". " error

I also using realUrl.

the enable404forInvalidAlias is set for my extension, so a non-existing product call leads to the 404 page, but unfortunetly I couldn't handle till now the restricted access question.

Version is: 4.5.22 Solution should be work without major update.

UPDATE:

In my showAction the product defined with = NULL default value.

I have already a condition in my fluid template like this:

<f:if condition="{product}">
...
</f:if>

The error message coming from this line:

Tx_Extbase_MVC_Exception_InvalidArgumentValue thrown in file
\typo3\sysext\extbase\Classes\MVC\Controller\Argument.php 
in line 389.

I made some debug and the whole showAction runs through.

András Ottó
  • 7,605
  • 1
  • 28
  • 38

1 Answers1

2

You can change the action in a way so that it allows for no-instances of your product and check for the existance within fluid:

public function showAction(Tx_YourExt_Domain_Model_Product $product = NULL) ..

in Fluid:

<f:if condition="{product}">
   <f:then> <!-- show your product --> </f:then>
   <f:else> 
      <!-- show a login form, e.g. something you have in typoscript -->
   </f:else>
</f:if>

Downside of this is, that you can't handle proper 404's easily.

There's an ifAuthenticated viewhelper as well and in combination with the above it should be straight forward to handle proper 404's as well. I'm not sure which TYPO3 version this has been introduced though.

konsolenfreddy
  • 9,551
  • 1
  • 25
  • 36
  • Actually both of them are good suggestion, but I have them also. To the error I update my question, I think the problem is in that part, when it tries to load the object, but because of the restricted (fe_group) acces it can't be returned, and here comes this exception from the core. – András Ottó Sep 23 '13 at 20:25
  • I reviewed my code, there was a missing = NULL declaration. Thanks for the help, that was leading me to the solution. – András Ottó Sep 24 '13 at 05:38