tags:

views:

113

answers:

3

I have a DNN site that I now want to change so that users must log in beofre they can view any of the content. I can go to each page an change the permissions but i am looking for a faster way - even if that means going into the database.

A: 

You can just use IIS authorisation to do it, if you wish, but it doesn't provide "registration".

http://msdn.microsoft.com/en-us/library/aa292114%28VS.71%29.aspx

Noon Silk
DotNetNuke has its own registration and permission system.
Lance McNearney
Lance: Yes, obviously, but you'll note that's not what he asked.
Noon Silk
A: 

The fastest way would be to write an update statement against the TabPermission table. Most likely you would change all of the -2 or -1 (depending on DNN version) values to something like Registered Users.

Use caution, backup your database, and test it before you actually do it in production. I can't stress that enough.

You'll want to look at the ModulePermissions table as well.

Chris Lively
+2  A: 

This will remove all of the "Unauthorized Users" permissions from all of the pages on a portal:

DELETE
FROM TabPermission
WHERE RoleID = -3 -- Unauthorized Users
AND TabID IN (
    SELECT TabID
    FROM Tabs
    WHERE PortalID = YOUR_PORTALID_HERE
)

Then replace all of the "All Users" permissions with "Registered Users":

UPDATE TabPermission
SET RoleID = -2 -- Registered Users
WHERE RoleID = -1 -- All Users
AND TabID IN (
    SELECT TabID
    FROM Tabs
    WHERE PortalID = YOUR_PORTALID_HERE
)

After you run this, go to Host -> Host Settings and under the Performance section hit "Clear Cache".

You could run a similar statement against the ModulePermission table but it shouldn't be necessary if you're locking down all of your pages since if they can't view any pages they won't be able to view any modules.

Not responsible if any of this destroys your database, injures your pets, etc. Make sure to backup your database before running the script!

Lance McNearney