WinForms - Syntax for settings permissions

Discussion about the open-source Phalanger [?] project.

WinForms - Syntax for settings permissions

Postby paul.bentley » June 24th, 2012, 10:24 am

Hello,

I'm working on a project using WinForms. I set up a WebBrowser component and I'm trying to set the security settings to get data from a webpage displayed in the component.

Unfortunately I got stuck on the syntax. Can you please advice what's the correct PHP Phalanger syntax for the following code?

---------------

[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
[System.Runtime.InteropServices.ComVisibleAttribute(true)]

...

The full code is at http://msdn.microsoft.com/cs-cz/library ... pting.aspx

Thank you
paul.bentley
 
Posts: 2
Joined: June 24th, 2012, 9:22 am

Re: WinForms - Syntax for settings permissions

Postby Jakub Misek » June 24th, 2012, 3:34 pm

Hi,
thanks for the question!

I have to admit, I had to take a look into the parser to find out. However there is a small bug (because nobody ever who contacted us tried it before) The bug is fixed now; the fix will be pushed on github first, then into the upcoming release.

The syntax for your case is following:
Code: Select all
use System\Security\Permissions;

[Permissions\PermissionSet(Permissions\SecurityAction::Demand, $Name=>"FullTrust")]


It is very the same as in C#, just namespace and variable syntax as from PHP (\ instead of ., $Name instead of Name), and named parameters uses '=>' instead of '='. Of course you have to reference 'mscorlib' assembly.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: WinForms - Syntax for settings permissions

Postby paul.bentley » June 24th, 2012, 7:50 pm

Hi Jakub,

thank you very much for the very quick reply and bug fix.

I have one more bug to report. I'm currently using an older (March) release of Phalanger because there's a bug in the June one.

If you create a brand new project for Phalanger WinForms and you press F5, it displays an error message concerning incorrect classes (as far as I remember).

If you could have a look at it, it'd be great.

Thank you
paul.bentley
 
Posts: 2
Joined: June 24th, 2012, 9:22 am

Re: WinForms - Syntax for settings permissions

Postby Jakub Misek » June 24th, 2012, 8:15 pm

Thanks! The bug is replicable and has been added onto our todo list.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 17 guests

cron

User Control Panel

Login

Who is online

In total there are 17 users online :: 0 registered, 0 hidden and 17 guests (based on users active over the past 5 minutes)
Most users ever online was 399 on April 19th, 2024, 11:49 pm

Users browsing this forum: No registered users and 17 guests