开发者

Is there an easy way to make all pages of a DNN site viewable by registered users only?

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 goin开发者_StackOverflow中文版g into the database.


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!


The fastest, non-technical method is to go to the parent pages on the portal, change the permissions to suit you, then copy those permissions to the child pages. If you have tons of parent pages, go to Admin>Pages and group all parent pages under one parent page... change the parent permissions and copy to all child pages, then reinstate your page hierarchy.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜