Permissions exception during debug while using Glimpse - glimpse

I get exceptions during debug when using Glimpse:
The SELECT permission was denied on the object 'XXX', database 'YYY', schema 'dbo'.
Background:
We have an MVC3 web application using Linq2Sql to access the database (the connection string is not in web.config but set programmatically)
The metadata tab is not filled properly in the Glimpse panel
The sql tab is filled properly in the Glimpse panel, both using Glimpse.ADO and FlexLabs.Glimpse.Linq2Sql
Dbo does not (and should not) have access to specified object and database. For database access we set a connection string programmatically that specifies the user
So the problem seems to be that Glimpse is trying to fill the metadata tab in the Glimpse panel by using dbo to access the database - that will not work in our case.
Is there any way to programmatically specify a connection string that Glimpse should use, or can we turn of the metadata tab to avoid this problem. A setting would in our case not be useful as we cannot have the connection string in web.config.

You can disable the metadata tab by adding the following ignore rule to the Glimpse configuration
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<tabs>
<ignoredTypes>
<add type="Glimpse.Mvc.Tab.Metadata, Glimpse.Mvc3" /><!-- or Glimpse.Mvc4 -->
</ignoredTypes>
</tabs>
...
</glimpse>

Related

How to dynamically authorize users in MVC inside Application_Start

I am using MVC 5 to build an application. In my web.config I have defined a custom section which I will use to display menu to user. It is something like:
<Menus>
<Menu>
<MainMenu Title="Home"></MainMenu>
<SubMenus>
<SubMenu Title="Page1" PageName="home/index" ADGroup="BusinessUsers">
<SubMenu Title="Page2" PageName="home/index2" ADGroup="ITUsers">
</SubMenus>
</Menu>
<Menu>
<MainMenu Title="About Us"></MainMenu>
<SubMenus>
<SubMenu Title="Another Page1" PageName="about/mypage1" ADGroup="BusinessUsers">
<SubMenu Title="Some Other Page" PageName="about/mypage2" ADGroup="OtherUsers">
</SubMenus>
</Menu>
</Menus>
I am using Windows authentication and everyone will have access via AD groups. By default I have denied access to all users using authorization rule in web.config like below:
<authorization><deny users="*"/></authorization>
Is it possible to define authorization rules based on MENU above in Application_Start at runtime? Something like:
Global.Filters.AuthorizeUser("BusinessUsers", "home/index, about/mypage1");
Global.Filters.AuthorizeUser("ITUsers", "home/index2");
What you're doing here isn't a standard way of defining a menu, so there is no standard way of enforcing authorization on it. You will need to implement it yourself.
Somewhere in your code during a request, you will have to loop through each SubMenu and use HttpContext.Current.User.IsInRole("DOMAIN\\GroupName") to test whether the user is in the appropriate group. I can't give you any further direction than that without seeing more of your code.
I'm sure you have your reasons for putting this in web.config, but what I have done in my own projects is define the menu in a partial view and check the roles right in the view:
#if (HttpContext.Current.User.IsInRole("DOMAIN\\GroupName") {
Some menu item
}
If you're worried about being able to update the menu items without recompiling the whole project, then that's still fine since the cshtml files aren't compiled anyway - you can update it on the fly.

authentication_ui_failed: The browser based authentication dialog failed to complete

Using below method query a token result in universal app:
AcquireTokenAsync(string resource, string clientId, Uri redirectUri, PromptBehavior promptBehavior);
No problem in F5 debug mode, but hit error when installed the app manually by a published store app package.
the error message:
authentication_ui_failed: The browser based authentication dialog failed to
complete. The system cannot locate the resource specified. (Exception
from HRESULT: 0x800C0005)
Please check the capabilities of your universal app. Following capabilities must be enabled for AAD browser authentication UI popup to be shown:
Enterprise Authentication
Internet(Client & Server)
Private Networks(Client & Server)
Shared User Certificates
If you want to enable them from the package.appxmanifest xml file of your app you should have following entries inside Capabilities tag as below which corresponds to above capabilities in the same order:
<uap:Capability Name="enterpriseAuthentication"/>
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer" />
<uap:Capability Name="sharedUserCertificates" />
Hope this helps!
I got the same error message, although my problem was that I was using wrong redirectURI.
Need to use the one generated by:
redirectURI = Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri();

Why this script is only working in preview mode - Kentico

Why below script is only working in preview mode of Kentico CMS
{% Documents["/Page-Resource/Portfolio/Product-Marketo"].GetValue("Description") #%}
Actually had a issue with the macro permissions for document collections. In such case, disable the check by adding the following key to web.config file:
<add key="CMSCheckPermissionsForDocumentCollection" value="false"/>
Another option:
For the document you reference in your macro, go to Properties > Security, add "Public Anonymous User (public)" to the "Users and Roles" box, and check "Read" for their "Access rights". Click OK.

Configuring the Runtime Policy in Glimpse MVC4 , EF6

I used the runtimepolicies element in my web.Config file to configure the runtime policy.
But when run the application give a run-time exception like below.
Parser Error Message: Unrecognized element 'runtimepolicies'.
Please give me your support to configure the runtime policy in the Glimpse correctly.
The easiest way to do this, is by going to [yoursite]/glimpse.axd and use the configuration tool on the right side.
You can then check and uncheck wanted or unwanted runtime policies, tabs,... and it will show you the config changes you need to apply.
Updated answer to show correct configuration based on comment below
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<runtimePolicies>
<ignoredTypes>
<add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"></add>
</ignoredTypes>
</runtimePolicies>
</glimpse>

Disable ClientSide Validation

in this posting:
How to disable Client-side Validation for an XPage?
Sven demonstrated setting the property to disable the client side validation.
<xp:this.properties>
<xp:parameter name="xsp.client.validation" value="false" />
</xp:this.properties>
I tried this in a test XPage and it works great, I then tried it in my application and I get an error when the Submit button is clicked that my Rich Text Field is undefined. I have a custom control that contains all the input and validation and it is called from the an ext Lib Application Layout Control. I have removed most everything I can from my App Layout but when I do a submit it does the correct validation but also gives the message:
---------------------------
xpWFSDemoInput
---------------------------
An error occurred while updating some of the page.
dijit.byId("view:_id1:_id2:_id3:_id4:callback1:_id145:callback1:_id148:inputRichText1") is undefined
---------------------------
OK
---------------------------
I place my input custom control inside a new Xpage, set the parameter on the Xpage and run it and it works fine, it sees the RichText and processes it correctly. So there would appear to be something in the App Layout that is causing problems.
I will try putting the Ext Lib Applayout into an XPage and see what happens.
Some further info -- I found the problem code which is some client side script that does a periodic time check. No idea why it hates the RTF though.
If you want to disable client-side validation for the application, you can do so in the Xsp Properties in the application. You can also do it in an xsp.properties file on the server. Check out XPages Portable Command Guide for more details on this and all xsp.properties settings

Resources