Servoy 8.2 RC1 : can't show form because it is not allowed

Hi,

After running our code in Servoy 8.2 RC1 this error comes
We were told our custom components might be broken due to update angular files; has this error something to do with that?
The notification “…because it is not allowed in the client…” is new to me

Thanks

2017-08-10 11:22:42,744 ERROR [Executor,uuid:6f5280b2-889b-403b-b3b1-0d10930594ab] org.sablo.websocket.WebsocketEndpoint - Error: Can’t show form ng$demo_dashboard for component +

java.lang.IllegalAccessException: Can’t show form ng$demo_dashboard for component +
at com.servoy.j2db.server.ngclient.NGClientWindow.isVisibleAllowed(NGClientWindow.java:217)
at com.servoy.j2db.server.ngclient.NGFormServiceHandler.executeMethod(NGFormServiceHandler.java:214)
at org.sablo.websocket.WebsocketEndpoint$5.run(WebsocketEndpoint.java:333)
at org.sablo.eventthread.Event$1.run(Event.java:100)
at org.sablo.websocket.CurrentWindow.runForWindow(CurrentWindow.java:77)
at org.sablo.eventthread.Event.execute(Event.java:90)
at org.sablo.eventthread.EventDispatcher.dispatch(EventDispatcher.java:125)
at org.sablo.eventthread.EventDispatcher.run(EventDispatcher.java:89)
at com.servoy.j2db.server.ngclient.eventthread.NGEventDispatcher.run(NGEventDispatcher.java:55)
at java.lang.Thread.run(Thread.java:745)

2017-08-10 11:22:42,746 ERROR [Executor,uuid:6f5280b2-889b-403b-b3b1-0d10930594ab] org.sablo.websocket.WebsocketEndpoint - Error: Can’t show form: ng$demo_dashboard because it is not allowed in the client

don’t think it is that
You have your own components?
Are those component showing forms itself?

How are those exactly configured? Do you have an example?

Because this is hitting a security feature that a component can’t just show any form it wants, that must be configured correctly on the server (like a form property that has that form assigned)

We have own components indeed and the “bread-crumb-main” is showing some forms.
This ng$demo_dashboard is being shown by the breadcrumb component, with a function :

function setRealContainedForm(formname, relationname) {
					if (formWillShowCalled != formname && formname) {
						formWillShowCalled = formname;
						if ($scope.model.waitForData) {
							$q.when($scope.svyServoyapi.formWillShow(formname, relationname)).then(function() {
								realContainedForm = formname;
							});
						} else {
							$scope.svyServoyapi.formWillShow(formname, relationname);
							realContainedForm = formname;
						}
					}
				}

We show different kinds of forms but have not specified any permissions or restrictions. Where on server do you mean we should configure this ?

can you show me the spec file of that component?

i guess the parameter “formname” is of property “form” ?

it is called form here in the spec file

"model":
	{
			"tabs":  {"type":"tab[]", "pushToServer": "allow","droppable":true},
			"styleClass" : { "type" :"styleclass"},
			"height" : {"type":"int", "default":"500"},
			"tabSeq" : {"type" :"tabseq", "tags": { "scope" :"design" }},
			"isLoaded":{"type":"boolean","default":true},
	    	"visible" : "visible",
	    	"tabtype" : {"type":"string", "default":"normal"}
	},"handlers":
	{

	},
	"api":
	{
		"addTab": {
			"parameters": [
				{ "name": "form", "type": "form" },
				{ "name": "nameArg", "type": "string"},
				{ "name": "tabText", "type": "string"},
				{ "name": "tooltip", "type": "string"},
				{ "name": "iconURL", "type": "string"},
				{ "name": "fg", "type": "string"},
				{ "name": "bg", "type": "string"},
				{ "name": "relation", "type": "relation"},
				{ "name": "index", "type": "int"}
				
			]
		},
		"removeTabAt":{
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"removeAllTabs":{},
		"getMaxTabIndex":{"returns":"integer"},
		"getTabFormNameAt":{
			"returns":"form",
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"getTabNameAt":{
			"returns":"form",
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"getTabRelationNameAt":{
			"returns":"relation",
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"getTabTextAt":{
			"returns":"string",
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"isTabEnabledAt":{
			"returns":"boolean",
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"setTabEnabledAt":{
			"parameters": [
				{ "name": "index", "type": "integer" },
				{ "name": "enabled", "type": "boolean" }
			]
		},
		"setTabTextAt":{
			"parameters": [
				{ "name": "index", "type": "integer" },
				{ "name": "text", "type": "tagstring" }
			]
		},
		"setTabType":{
			"parameters": [
				{ "name": "tabtype", "type": "string" }
				
			]
		},
		"setTab":{
			"parameters": [
				{ "name": "index", "type": "integer" }
			]
		},
		"getSelectedIndex":{
			"returns":"integer"
		}
	},
	"types": {
  	 "tab": {
  	 	"active": {"type":"boolean","default": false,"tags": { "scope" :"private" }},
  	 	"name": {"type":"string"},
  	 	"containedForm": "form",
  		"text": {"type":"tagstring","default":"tab"},
  		"relationName": "relation",
  			"enabled": 
		{
			"type": "enabled",
			"default": true 
			
		}
  		
  		}
	}

and i guess addTab api calls the above function.

In servoy itself those are all server side scripting calls that just adjust the model
But i guess it doesn’t really register correctly the relation and form name if they are direct parameters of an api call that is really getting to that on the client

Can you make a case for this

Hi Johan,

Is it ok to just refer to this topic in the case ?
I don’t know how to build a demo solution without giving our components in them, and maybe servoy developers now enough with your explanation?

Robrecht

Yes that is ok. I hope we can reproduce it then

just tried to reproduce it and i couldn’t
it is working fine for me so you have to give us an example what is going wrong

i made an example:

"api": 
	{
		  "addTab": {
	            "returns": "boolean",
				"parameters":[
								{                                                                 
 								"name":"form/formname",
								"type":"form"
			                	},
             					{                                                                 
 								"name":"relatedfoundset/relationname",
								"type":"relation",
			            		"optional":true
			            		}             
							 ]
					}
	  }

with that as an api

then

 $scope.api.addTab = function(form,relation) {
    		  $scope.svyServoyapi.formWillShow(form, relation);
    		  $scope.svyServoyapi.getFormUrl(form);
    		  console.log(form + " :: " + relation)
			  formName = form;
			  $scope.model.yourName = form + " :: " + relation;
    	  }

showing that and calling onshow and getFormUrl didn’t result in an exceptions
and i could also show the form just fine

<div ng-include="getForm()"/>

 $scope.getForm = function() {
    		  return $scope.svyServoyapi.getFormUrl(formName);
    	  }

Ok thanks for your effort
We will build a sample solution and make a case with it.

Morning.

Any news on this issue. We are facing the same here.

Cheers

what exact thing?

do you have your own components? (that are showing forms?)

what do you exactly get when you do what?

This is already pretty old post