+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Permissions issue with Generic Content module

Permissions issue with Generic Content module

8 posts, 1 answered
  1. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    13 Jan 2010
    Link to this post
    Hi,
    I've implemented a generic content-based module with very similar functionality to the sample products module. It actually mirrors it very closely, I used it as a starting point. We added users and assigned them a custom role. This role is restricted to all but this module... but we did not implement any permissions. I didn't think we needed to, as it inherits from WebModule, not SecureModule. We want everyone to have it available, and thought it would be, but when one of these users click on the module name, this error appears:

    Security Exception 
    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 
     
    Exception Details: System.Security.SecurityException: Permission denied. 

    Here is the stack trace:
    [SecurityException: Permission denied.] 
       Telerik.Security.Permissions.ApplicationPermission.ThrowSecurityException() +130 
       Telerik.Security.Permissions.ApplicationPermission.Demand() +20 
       Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateChildControls() +315 
       System.Web.UI.Control.EnsureChildControls() +87 
       System.Web.UI.WebControls.CompositeControl.RecreateChildControls() +21 
       Telerik.Cms.Engine.WebControls.Admin.ControlPanel.set_Mode(Modes value) +910 
       Telerik.Cms.Engine.WebControls.Admin.ControlPanel.set_ProviderName(String value) +51 
       Zag.Puppies.WebControls.Admin.CommandPanel.CreateChildControls() +505 
       System.Web.UI.Control.EnsureChildControls() +87 
       System.Web.UI.Control.PreRenderRecursiveInternal() +50 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Control.PreRenderRecursiveInternal() +170 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350 
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213 
       System.Web.UI.Page.ProcessRequest() +86 
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18 
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
       ASP.sitefinity_admin_modules_aspx.ProcessRequest(HttpContext context) in c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\d317962b\f9b1b0e2\App_Web_tswb68ix.2.cs:0 
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358 
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64 
     

    This also looks very similar to another forum post, but the eventual solution was not provided:

    I have not tried seeing if this same problem would occur with the sample products module (simple version), but as it follows the same design (inherits same classes), I would expect it to exhibit the same behavior.

    Thanks in advance. Let me know if you need more information.
    Thank you,
    Will
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Jan 2010
    Link to this post
    Hi Will,

    "Description: The application attempted to perform an operation not allowed by the security policy.
     To grant this application the required permission  please contact your system administrator or change the application's trust level in the configuration file."


    The error above says that your you are trying to perform an operation that is not allowed by the trust level of your host. Are you running your module in Medium Trust? If so, make sure that your website is configured to run correctly under medium trust level. We support the standard policy for medium trust level. If there are any additional restrictions you may experience this error. You could also try to compile the module to dll and use it with your project.


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    13 Jan 2010
    Link to this post
    Thanks Ivan,
    I will look into the trust level on the host (have not had to touch this before).

    Something else, the module works fine, front-to-back, for users with the administrators role. Would the trust level not apply to them?
    Thank you!
    Will
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Jan 2010
    Link to this post
    Hi Will,

    The error is thrown when  the ControlPanel tries to create its child controls Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateChildControls() which does not have any relation with the role of an user.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    13 Jan 2010
    Link to this post
    I get that, and maybe I'm missing something, but why then would it occur for my limited role while it loads fine for administrators?
    Thanks,
    Will
  6. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    13 Jan 2010
    Link to this post
    I don't think the module is running at medium trust, we do not specify the trust anywhere, and the Event log details say: "Trust level: Full"

    I'm looking at implementing permissions with SecuredModule, but this seems unnecessary.
    Will
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    14 Jan 2010
    Link to this post
    Hi Will,

    The error is thrown, because your module does not inherit form SecuredModule. You are using base.ControlPanel which calls Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateChildControls() where GetPermission(CrudRights.View) is used.I suggest that you should inherit from abstract class SecuredModule and implement SecurityRoot and SecurityRoots. You can take a look at the following articles:

    Products module: Implementing permissions
    Programming Security: Permissions


    If you inherits from ProviderControlPanel<TOwner> you should not get if you are running the module in full trust.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  8. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    14 Jan 2010
    Link to this post
    Ivan,
    Thanks for these details and confirming the solution (implement SecuredModule). This looks well documented and straight-forward to implement, but I wanted to make sure there wasn't an easier way.

    Thank you, answer accepted.
    Will
Register for webinar
8 posts, 1 answered