System.InvalidCastException - class & handler without CheckPermission attribute
Closed this issue · 0 comments
mmnosek commented
I've got following json:
{
"Html": "",
"SomeNotSecuredProperty": {
"SomeProperty": 0
}
}
and json-behind:
[RequirePermission(typeof(ViewSpecificThing))]
public partial class ExampleChildrenDataPage : Json, IBound<Thing>
{
[ExampleChildrenDataPage_json.SomeNotSecuredProperty]
public partial class PropertyItem : Json
{
private void Handle(Input.SomeProperty action)
{
//some code
}
}
}
And when I trigger SomeProperty change, exception is thrown:
System.InvalidCastException : Unable to cast object of type 'PropertyItem' to type 'Starcounter.Authorization.Tests.PageSecurity.ExampleChildrenDataPage'.
at lambda_method(Closure , Json , Input`1 )
at Starcounter.Templates.Property`1.InvokeHandler(Json parent, Input`1 input) in C:\TeamCity\TeamCity10\buildAgent\work\sc-pnext-nightly-334\Level1\src\Starcounter.XSON\Templates\Foundation\Property.cs:line 262
at Starcounter.Templates.Property`1.ProcessInput(Json parent, T value) in C:\TeamCity\TeamCity10\buildAgent\work\sc-pnext-nightly-334\Level1\src\Starcounter.XSON\Templates\Foundation\Property.cs:line 284