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.0Can I base a module instance on a value in the querystring?Can I base a module instance on a value in the querystring?
Previous
 
Next
New Post
2/20/2009 9:34 PM
 

I've inherited a DNN site that is not working as it is supposed to.

Use case:
There is a DNN page that displays a number of authors and link to their detail pages.  The links to the pages are in the form:

    Default.aspx?tabname=AuthorDetails&AuthorID=527

Clicking on this will result in a URL such as:

    Authors/AuthorDetails/tabid/63/AuthorID/527/Default.aspx

On this page (TabID 63) there is a custom module that displays some information about the author whose ID=527.  The module reads the QueryString and performs the approriate actions against the database to return and display the information specific to AuthorID 527.

Now, let's say that Author 527 is a registered user of the site and goes by the UserName of EdPoe.  I want to be able to set the permissions of the module on TabID 63 such that only EdPoe has the ability to edit it.  That allows EdPoe the opportunity to edit his own information on his own detail page but nobody else will be able to edit the module.  This way each of the authors can be setup to edit the information on their personal detail pages (TabID 63) but not on any other author detail page.

Problem:
Setting up an author to be able to edit the module on his detail page makes it so s/he has the authority to edit the module on every author's detail page.  It appears there is actually only one instance of the module and it is diplayed every time TabID 63 is displayed.  Even though the code in the module pulls back data specific to the AuthorID in the QueryString the permissions for the module are the same on every instance of TabID 63.

Request:
Is there a way to "individualize" the module (based on the AuthorID in the QueryString) so that the edit permissions only allow an author to edit the module on their own page?  Since I'm customizing the data displayed by TabID 63 but not customizing the ModuleID for the module on that page I guess every instance of TabID 63 has the exact same instance of the module on it.  I'm aware that there is a ModuleID that is supposed to differentiate separate instances of a single module.  Can I set the instance of the module on a given detail page to be equal to the AuthorID in the QueryString (which is unique)?


Thanks very much,

BK

 
New Post
2/21/2009 5:29 AM
 

 please note, that the detail page is not a real DNN page - it is a view in your module and you need to validate write permission inside your module by comparing valaue of "created by" (or whatever the field is called inside the table of your module) with the userID or username of the currently logged user.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
2/21/2009 12:56 PM
 

Thanks for the reply -

Actually, I think it is a real DNN page as it comes up under "Pages" on the admin menu.  It's just that it a reusable page that has a bunch of self-aware moduels on it.  When the page is instantiated with a call to its TabID it is passed an AuthorID.  That allows it to display info for that particular author.  You are right that there is a disconnect between the UserID of the logged in user and the AuthorID.  The DNN system has no way of knowing which UserID is the author for a given detail page.  So, some human is going to have to go in and realize that UserID EdPoe is really author Edgar Allen Poe and ensure that the permissions on the module on the Edgar Allen Poe detail page are set to only allow admins and EdPoe to edit it.

The problem I've come to realize is that when you drop a module on a page that module is assigned a unique ModuleID.  This means that every time I use the detail page (and I'm always using the same TabID) the module on that page has the same ModuleID.  The permissions are attached to that ModuleID and thus no matter what AuthorID has been passed to the page the permissions on the module will be the same and will be based on UserID.

I did a  lot of noodling on this last night and came up with a game plan.  Everything in DNN is table based.  So the definition of the detail page including the modules on it and the moduleIDs are all kept in tables.  The pages are built on the fly based on the info in the database tables.  I think what I'm going to do is use SQL Profiler to figure out what tables are affected when you build a new page.  With that info I should be able to build SQL to literally add a new page to the database (including all of its modules and permission and anything else that defines a page).  Then, rather than actually call a static TabID and pass it an AuthorID to use by its modules I'll call a function and pass it the TabID I want the page to have.  My function will test to see if I've already defined the page (in the tables) and if not, create it.  Then I'll have a page with a TabID = AuthorID that is a copy of the detail page except the module in question will have a new ModuleID and therefore its own permissions.

We'll see if my vision works or if I'm out of my mind.  Now I must figure out if there is any function in DNN that will clone a page.  If so I can leverage that or at least run SQL Profiler and see what kind of work it does.

Thanks,

BK

 
New Post
2/21/2009 1:02 PM
 

There is a method called TabInfo.Clone() that may allow me to make copies of the detail page and then customize them with a unique ModuleID.  If I can't use the method directly at least I hope to be able to watch what it does and build similar functionality.  We'll see.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Can I base a module instance on a value in the querystring?Can I base a module instance on a value in the querystring?


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