I am developing a module for DNN 7.1+, and I need to show / hide the link in the module based on whether the user has edit permission for this module. I want this to happen regardless of whether the page is in edit mode.
Currently, I have the following code in the view.ascx of a user module page load event:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Try
''other code goes here.......
If IsEditable = True Then
AdminEdit.Visible = True
Else
AdminEdit.Visible = False
End If
Catch exc As Exception
Exceptions.ProcessModuleLoadException(Me, exc)
End Try
End Sub
AdminEdit is the identifier of the item I want to hide. This code works when the page is in edit mode, but I want it to always be visible, regardless of the edit mode, if the user has edit permission for this module.
IsEditbale false, .
: , ?
EDIT: ,
:
bdukes:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Try
''display template selector if user has edit rights over module
If DotNetNuke.Security.Permissions.ModulePermissionController.CanEditModuleContent(Me.ModuleConfiguration) Then
AdminEdit.Visible = True
Else
AdminEdit.Visible = False
End If
Catch exc As Exception
Exceptions.ProcessModuleLoadException(Me, exc)
End Try
End Sub