Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Setup permission Of Tabs programmaticallySetup permission Of Tabs programmatically
Previous
 
Next
New Post
3/3/2007 2:15 AM
 
Need help on how to setup Permission on the tabs , these tabs i am creating through code only. I have done the following work in the button click :-

                Dim MyPage As New TabInfo
                Dim MyPageController As New TabController
                Dim clPermission As New DotNetNuke.Security.Permissions.TabPermissionCollection
                Dim InfPermission As New DotNetNuke.Security.Permissions.TabPermissionInfo
                Dim myroles As New DotNetNuke.Security.Roles.RoleController
                Dim i As New DotNetNuke.Security.Permissions.TabPermissionController
                With InfPermission
                    .AllowAccess = True
                    .RoleID = -1
                    .RoleName = "All Users"
                    .TabID = TabId
                    .PermissionID = 3 ' View
                End With
                clPermission.Add(InfPermission)

                With InfPermission
                    .AllowAccess = False
                    .RoleID = 2
                    .RoleName = "Subscribers"
                    .TabID = TabId
                    .PermissionID = 3 ' View
                End With
                clPermission.Add(InfPermission)

                With InfPermission
                    .AllowAccess = True
                    .RoleID = 0
                    .RoleName = "Administrators"
                    .TabID = TabId
                    .PermissionID = 3 ' View
                End With
                clPermission.Add(InfPermission)
                With MyPage
                    .PortalID = PortalId
                    .TabID = TabId
                    .TabName = "OneAnotherPage"
                    .Title = "Testing Page"
                    .Description = "Some Description"
                    .KeyWords = "Some keywords"

                    ' .ParentId = 0 we dont need to set the ParentID if wants to be in the root level

                    .DisableLink = False
                    .IconFile = ""
                    .Url = ""
                    .IsVisible = True
                    .IsDeleted = False
                    .SkinSrc = "" ' No Need to specify the skin here
                    .ContainerSrc = ""
                    .StartDate = Null.NullDate
                    .EndDate = Null.NullDate
                    .RefreshInterval = 0
                    .PageHeadText = ""
                    .TabPath = GenerateTabPath(.ParentId, .TabName)
                    .TabPermissions = clPermission
                End With
                MyPageController.AddTab(MyPage, False)

Please let me know what and where i am missing or doing something wrong. Also, i have studied the managetabs.ascx but its using some permissiongrid which is compiled one. Please help me!!!
 
New Post
8/13/2007 10:13 AM
 

Did you get this working? I am also trying to add tabs through code and give specific users edit permission on the tab. I compare what you have to what I have, I also was reviewing the managetabs code.

 
New Post
8/13/2007 11:10 AM
 

Have you looked under DotNetNuke.Library project? Inside Controls/DataGrids/Permissions Grids there are several files you might want to look at.


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
8/13/2007 2:19 PM
 

I'll preface this the same way I do all VB code posts, I'm a C# programer, so I may have some details about what needs to be done in VB, wrong.

I'm not sure about this part in VB, but before each "With InfPermission" you may want to set it equal to a new object, or else it may change the permission for the previous permissions. I've had this happen with a few things in C#, so I do it all the time. Not positive if that will happen in VB, but it is something I have to do, so just suggesting it.

Does the page you are trying to make get made? Just lacking the proper permissions?

One thing I see that never directly happens, and I don't know if it happens in the AddTab section. You never ADD the tabpermissions to the system. you add it to the collection and set the collection in the Tab permissions, though I'm not positive if that will work. I think I had trouble with that doing nothing when I tried it.

Here's my suggestion of what to try:
Create the tab
Fill the TabPermission object after setting it to a new TabPermission object

(Here's the 'missing' part)Use the TabPermissionController to AddTabPermission.

Then use DataCache.ClearTabsCache(PortalId) and DataCache.ClearTabPermissionsCache(PortalId) to refresh the permissions for instant effect.

I think that series of actions will do what you need. I haven't dealt with programatically creating tabs, so get the tab to create, and from there I have successfully added and removed permissions (role and individual) to tabs.

I hope that helps

 
New Post
8/14/2007 2:33 AM
 

Hi guys....I got this problem solved long time before from myself and I agree with Mr. Baatezu that biggest mistake was NOT to Fill the TabPermission object after setting it to a NEW TabPermission object and as as soon i ......the result was positve......

 

so anyone who stuck with kind of problem please follow the Mr. Baatezu's step and Happy DNN.

 

Enjoy!!!

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Setup permission Of Tabs programmaticallySetup permission Of Tabs programmatically


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out