User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:issue:7075:integration_with_dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mantisbt:issue:7075:integration_with_dokuwiki [2011/08/19 02:38]
toddpw
mantisbt:issue:7075:integration_with_dokuwiki [2015/02/13 18:11] (current)
dregad Use InterWiki syntax for MantisBT bug links
Line 1: Line 1:
 ====== Integrating DokuWiki with Mantis ====== ====== Integrating DokuWiki with Mantis ======
 +
 +
 +
 +
 +
 +
 +
 +
  
 ===== Disclaimer ===== ===== Disclaimer =====
Line 7: Line 15:
 and should work with subsequent versions (modulo bugs). and should work with subsequent versions (modulo bugs).
 It may work with older versions of mantis provided you make the File Changes described below. It may work with older versions of mantis provided you make the File Changes described below.
 +----
 +
 +
 +
 +
  
 ===== Integration Functionality ===== ===== Integration Functionality =====
Line 16: Line 29:
   * Adds a Wiki link on the issue view simple/​advanced pages to their corresponding Wiki issue page.   * Adds a Wiki link on the issue view simple/​advanced pages to their corresponding Wiki issue page.
   * Adds a Wiki menu option which maps to the corresponding project Wiki page, or general page in case of "All Projects"​.   * Adds a Wiki menu option which maps to the corresponding project Wiki page, or general page in case of "All Projects"​.
-  * Provides a way for Wiki pages to link to Mantis issues, e.g. ~~Mantis:7075~~+  * Provides a way for Wiki pages to link to Mantis issues, e.g. [[Mantis>7075]]
-  * Correctly manages HTTP Authentication. See (http://​www.mantisbt.org/​bugs/​view.php?​id=12458).+  * Correctly manages HTTP Authentication. See ([[mantis>​12458]]). 
  
  
Line 37: Line 51:
  
   * How Wiki access levels are determined: The Mantis auth backend included below takes the namespace containing the object being accessed, extracts the 2nd component, and looks it up in a flat list of Mantis projects. If there is a match, that project'​s access level is used, and if not, the global (ALL PROJECTS) access level is used. This means that ''​mantis:​project:''​ and ''​mantis:​subproject:''​ both get the access level of those Mantis projects, but ''​mantis:​project:​subproject:''​ gets the access level of ''​project'',​ AND ''​playground:​project:''​ also gets the access level of ''​project''​ even though it has nothing to do with the ''​$g_wiki_root_namespace''​ used by the various Wiki links on the Mantis side. This allows you to implement any number of areas in your wiki that use Mantis projects for access control, with the restriction that all namespaces must be of the form ''​top_level:​mantis_project:​*''​ (ie. any namespace just under a top-level namespace which matches a Mantis project name will use that project access level for itself and its child namespaces).   * How Wiki access levels are determined: The Mantis auth backend included below takes the namespace containing the object being accessed, extracts the 2nd component, and looks it up in a flat list of Mantis projects. If there is a match, that project'​s access level is used, and if not, the global (ALL PROJECTS) access level is used. This means that ''​mantis:​project:''​ and ''​mantis:​subproject:''​ both get the access level of those Mantis projects, but ''​mantis:​project:​subproject:''​ gets the access level of ''​project'',​ AND ''​playground:​project:''​ also gets the access level of ''​project''​ even though it has nothing to do with the ''​$g_wiki_root_namespace''​ used by the various Wiki links on the Mantis side. This allows you to implement any number of areas in your wiki that use Mantis projects for access control, with the restriction that all namespaces must be of the form ''​top_level:​mantis_project:​*''​ (ie. any namespace just under a top-level namespace which matches a Mantis project name will use that project access level for itself and its child namespaces).
 +
 +  * Another consequence of the simplistic code here is that it fails to adjust when ''​$g_wiki_root_namespace''​ is an empty string. In that case, the mapping function on the Mantis side omits the ''​mantis:''​ component in the Wiki namespace string, thus popping the flat project list up to the top level. But then the auth backend code below fails to find it, and every project Wiki link from Mantis takes you to a place that has only global access levels and your project access settings appear to be ignored. Of course, if you create a namespace just under any top level namespace with a Mantis project'​s name, that will continue to work fine.
  
   * Rename (if necessary) your projects and subprojects so that all their names are legal [[doku>​pagename]] identifiers. Otherwise the access level code will fail to map Wiki namespaces back into Mantis projects, and users will get global access levels instead of their project access level.   * Rename (if necessary) your projects and subprojects so that all their names are legal [[doku>​pagename]] identifiers. Otherwise the access level code will fail to map Wiki namespaces back into Mantis projects, and users will get global access levels instead of their project access level.
Line 137: Line 153:
  
 This will get you started. See the Tips section above for information about per-project group mappings. This will get you started. See the Tips section above for information about per-project group mappings.
 +
  
 ==== Mantis Authentication Backend (Single Sign-On) ==== ==== Mantis Authentication Backend (Single Sign-On) ====
Line 265: Line 282:
     function logOff(){     function logOff(){
         auth_logout();​         auth_logout();​
 +    }
 +
 +    /**
 +     * Get user data
 +     * (needed for e-mail subscriptions)
 +     *
 +     * @author Martin Arends http://​www.web-gestaltung.de
 +     */
 +    function getUserData($user) ​
 +    {
 +      $data = array();
 +      ​
 +      $t_user_id = user_get_id_by_name( $user );
 +
 +      if (isset($_REQUEST['​media'​])) {
 +          //media
 +          $t_project_name = explode( ':',​ getNS( getID("​media",​false) ) );
 +      } else {
 +          // normal page
 +          $t_project_name = explode( ':',​ getNS( getID() ) );
 +      }
 +
 +      $t_project_id ​  = project_get_id_by_name( $t_project_name[1] );
 +      $t_access_level = access_get_project_level( $t_project_id,​ $t_user_id );
 +      $t_access_level_string ​   = strtoupper( MantisEnum::​getLabel( config_get( '​access_levels_enum_string'​ ),  $t_access_level ) );
 +      $t_access_level_string_ex = strtoupper( $t_project_name[1] ) . '​_'​ . $t_access_level_string;​
 +      ​
 +      $data['​name'​] = $user;
 +      $data['​grps'​] = array( $t_access_level_string,​ $t_access_level_string_ex );
 +      $data['​mail'​] = user_get_email( $t_user_id );
 +      return $data;
     }     }
 } }
mantisbt/issue/7075/integration_with_dokuwiki.1313735884.txt.gz · Last modified: 2011/08/19 07:42 (external edit)