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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesBest way of using ServiceFramework.jsBest way of using ServiceFramework.js
Previous
 
Next
New Post
12/18/2015 1:01 PM
 
Joe Brinkman wrote:
The core platform already "renders" the ModuleId and TabId into the page output.  The platform uses the ClientAPI to save those values as a variable which can be read using dnn.getVar().  This is exactly how ClientServices gets those values.  The serviceframework needs to be initialized in the document ready event since the values are rendered in a hidden element at the bottom of the page.  If you try to access the variables before the page finishes rendering then the hidden element may not exist and you won't be able to retrieve the values.

 

Thanks for responding. 

Yes, but by putting TabID and ModuleID, wouldn't we be able to just access them directly from the cookies in JavaScript and not even have to bother with the ServiceFramework to get them where we need them? Not sure about the getAntiForgeryValue() / [ValidateAntiForgeryToken] though, is that something specific to DNN (the way the token is generated/decoded etc)?

 



I find that it is a bit extra work to handle the ServiceFramework.js implementation in a larger AngularJS app and thinking of if it could be improved.
 
New Post
12/18/2015 8:18 PM
 
Just in case someone missed it, as it is not mentioned on any of the "documentation pages" (ie blog posts) is the fact that you can also limit your WebAPI based on user roles. Now, this of course seem quite logical as you have the User ID, but how to do it isn't mentioned at all on any page I've found, expect for and old one regarding the previous MVC Service Framework.

To limit so that only users belonging to one or several roles can access the WebAPI methods, use

[DnnAuthorize(StaticRoles = "MyRoleName")]

Using that you don't have to bother with ModuleIDs or TabIDs as long as you can limit usage to different Roles.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesBest way of using ServiceFramework.jsBest way of using ServiceFramework.js


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