Adam Posted June 9, 2016 Share Posted June 9, 2016 Have not had a lot of time to work on my module that seems to be never ending. Almost got a fully working module, just got two issues A: ProcessWire complains that the module name is invalid, no matter what it is http://prntscr.com/beg9z6 B: Can't get the config values in a library that I am including, but thats an issue I will probably chase myself. But that whole invalid module name might be causing me issues as installing the module produces a white screen and you have to refresh that to actually install it. So would like to solve that before I try and fix my module config. Below is the top of my .module file, if that helps. class SAMLauth extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "SAML Auth", 'version' => "1.1.0", 'summary' => "Add SSO through SAML with this handy ProcessWire module", 'author' => "Adam Blunt", 'href' => "http://adamblunt.me/samlpw", 'autoload' => true, 'singular' => true ); } Link to comment Share on other sites More sharing options...
adrian Posted June 9, 2016 Share Posted June 9, 2016 Hey Adam - have you noticed the case used in the names of all other modules? Just match that and you'll be fine. Link to comment Share on other sites More sharing options...
kongondo Posted June 9, 2016 Share Posted June 9, 2016 (edited) What @adrian said... also see: https://processwire.com/api/coding-style-guide/#4-classes-properties-and-methods http://processwire.com/api/modules/ https://processwire.com/talk/topic/2394-how-to-present-your-module/ Edited June 9, 2016 by kongondo 1 Link to comment Share on other sites More sharing options...
Adam Posted June 9, 2016 Author Share Posted June 9, 2016 Yeah didn't notice the caps was important, thanks for that. Now got a second issue though Need a php library file to be accessible through a web browser for callbacks. But because the module directory is not web browsable I need to somehow make (processswire URL)\acs somehow load up the acs.php file in my module directory Any ideas on that last one? This is the last hurdle before my module can be released, I know it's sort of a niche module, but if it helps me then I think I should release it once complete. Link to comment Share on other sites More sharing options...
adrian Posted June 10, 2016 Share Posted June 10, 2016 Glad you sorted out the name problem. The simplest way for you to handle making acs.php url accessible is to instruct users of the module to move the file into the site root. You could try to do this programmatically on install, but the module may not have write permission so not good to rely on this. If the user has to manually move this is obviously more problematic for the user, so the best approach is probably to make a companion helper Process module and attach the process to a hidden page under Home > Admin. There a several example of this approach in the modules directory, but just because I just did this myself recently with Tracy, take a look at this: https://github.com/adrianbj/TracyDebugger/blob/master/ProcessTracyConsole.module You'll see that it adds a page that can be called via a URL and assigns the Process to that page. Also note that the main Tracy module: https://github.com/adrianbj/TracyDebugger/blob/master/TracyDebugger.module#L38 installs this helper module automatically. Hope that helps. Link to comment Share on other sites More sharing options...
Adam Posted June 10, 2016 Author Share Posted June 10, 2016 Thanks for that, defiantly a step in the right direction. But how would I make that a publicly accessible page, being a callback for login users in it's kind of pointless putting it as an admin page as it then requires you to already be logged in. I would assume that would require making some dummy templates within the module and then making the pages a child of the root or is the an easier way of doing it. Link to comment Share on other sites More sharing options...
adrian Posted June 10, 2016 Share Posted June 10, 2016 Ah sorry - yes of course that will be a problem for non-logged in users - didn't think that through If you go with dummy templates you'll still need to create a template php file in the site/templates directory to include your acs.php file. I think the easiest option is going to be to simply instruct users of the module to move acs.php to the root of their site. Another idea might be to check f the url contains acs.php and then hook on the pageNotFound to call a function which contains the logic from acs.php, eg: https://github.com/Notanotherdotcom/MarkupSitemapXML/blob/master/MarkupSitemapXML.module#L28 Maybe I am missing something else obvious - it's early and I am groggy! 1 Link to comment Share on other sites More sharing options...
Adam Posted June 10, 2016 Author Share Posted June 10, 2016 Ended up using the pageNotFound hook like you suggested, works like a charm. Still having some issues with the ProcessWire module config system, but will be easier just to bypass it and have users edit the settings.php file that the SAML library provides. Now just need to clean up the code a bit and my module is complete, which is cool. 1 Link to comment Share on other sites More sharing options...
adrian Posted June 10, 2016 Share Posted June 10, 2016 Still having some issues with the ProcessWire module config system Can you describe the problems you are having - they should be an easy fix. Link to comment Share on other sites More sharing options...
Adam Posted June 10, 2016 Author Share Posted June 10, 2016 It's more of an issue with the library I use, it requires the settings to be in a settings.php file and even when I use $this->setFuel it would not be accessible in that settings file for some reason, maybe because of the way it's included through a loader script. But because this is a login system it's probably best if you can't edit it inside ProcessWire, prevents accidental locking yourself out if you know what I mean. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now