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 revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
mantisbt:issue:7075:integration_with_dokuwiki [2011/08/15 11:07] toddpwmantisbt:issue:7075:integration_with_dokuwiki [2013/09/18 00:27] thu.doan
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 18: Line 31:
   * 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 (http://www.mantisbt.org/bugs/view.php?id=12458).
 +
 +
 +
  
 ===== Tips ===== ===== Tips =====
Line 23: Line 39:
 Following are some tips that are of interest to Mantis / DokuWiki integration: Following are some tips that are of interest to Mantis / DokuWiki integration:
  
-  * To define a template for all Wiki pages within a namespace, create ''_template.txt'' in the namespace folder (namespace is located into the DOKUWIKI_ROOT/data/mantis directory).  All pages created within this namespace will use the contents of the templates as a start point.  This will affect the way the Wiki is structured.   For example, if all issues within a project have a namespace, then they can all share one template, if there is a namespace per category, then there can be a template per category.  The exact structure to be used should be configurable through Mantis configuration.+  * To define a template for all Wiki pages within a namespace, create ''_template.txt'' in the namespace folder (namespace is located into the DOKUWIKI_ROOT/data/mantis directory).  All pages created within this namespace will use the contents of the templates as a start point.  This will affect the way the Wiki is structured.   For example, if all issues within a project have a namespace, then they can all share one template, if there is a namespace per category, then there can be a template per category.  The exact structure to be used should be configurable through Mantis configuration. However, the actual structure currently implemented is described in a tip later on in this section. 
 + 
 +  * The Wiki menu links in Mantis are equivalent to internal links for ''mantis:project:'' where: 
 +    * ''mantis'' is the value of ''$g_wiki_root_namespace'' from ''config_inc.php'' (note that this is not configurable per-project, it is specifically looked up as a global) 
 +    * ''project'' is the name of the current project, or nothing for ''ALL PROJECTS'' (ie. you get just ''mantis:'' which resolves to ''mantis:start'' if your [[doku>config:startpage|start]] config setting is still the install default) 
 + 
 +  * The View Issue Details Wiki links in Mantis are equivalent to internal links for ''mantis:project:issue:NNNN'' where: 
 +    * ''mantis'' and ''project'' are as described above for that Mantis project 
 +    * ''issue'' is just that word "issue" and is the namespace for all issues in this project 
 +    * ''NNNN'' is the numeric ID of the Mantis issue without leading zeros, and is a page, not a namespace 
 + 
 +  * 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. 
 + 
 +  * DokuWiki will see groups for each combination of Mantis project and access level that exist for the current user. For example: 
 + 
 +<code> 
 +my_namespace:my_project:* @ALL                 0 
 +my_namespace:my_project:* @MYPROJECT_VIEWER    1 
 +my_namespace:my_project:* @MYPROJECT_DEVELOPER 8 
 +</code>
  
 ===== Mantis Configuration ===== ===== Mantis Configuration =====
Line 64: Line 103:
 Install [[http://www.dokuwiki.org|DokuWiki]] and make sure it is working properly.  This involves making sure that you can create pages, edit them, view them, etc. Install [[http://www.dokuwiki.org|DokuWiki]] and make sure it is working properly.  This involves making sure that you can create pages, edit them, view them, etc.
  
-==== Configuration ====+==== Core Configuration ====
  
 Add/modify the configuration values show below in your DokuWiki installation. Add/modify the configuration values show below in your DokuWiki installation.
Line 82: Line 121:
  
 # #
-Modify the following configuration options to match the values below. +Once you have inc\auth\mantis.class.php created, modify the following configuration options to match the values below. 
-# With modern versions of dokuwiki, the bundled config plugin can set +# With modern versions of dokuwiki, the bundled config plugin can set these values, otherwise uncomment them here.
-these once you have inc\auth\mantis.class.php created.+
 # #
  
Line 91: Line 129:
 # $conf['defaultgroup'] = 'VIEWER';         // Default groups new Users are added to # $conf['defaultgroup'] = 'VIEWER';         // Default groups new Users are added to
 # $conf['superuser'] = '@ADMINISTRATOR';    // allows mantis administrator to access dokuwiki admin area # $conf['superuser'] = '@ADMINISTRATOR';    // allows mantis administrator to access dokuwiki admin area
 +
 +#
 +# If selecting the mantis auth backend results in fatal errors from redeclaration of utf8 functions, uncomment this:
 +#
 +# require_once( MANTIS_ROOT . 'core.php' );
 </code> </code>
  
-If dokuwiki fails with the folowing error: PHP Fatal errorCannot redeclare utf8_to_unicode() (previously declared in ..dokuwiki/inc/utf8.php, you may want to add folowing line to the end of the file+(utf8 redeclaration error referencehttp://www.mantisbt.org/bugs/view.php?id=11769) 
-<code>require_once( MANTIS_ROOT . 'core.php' );</code> + 
-(http://www.mantisbt.org/bugs/view.php?id=11769)+ 
 +==== Authorisation Configuration ==== 
 + 
 +Add the following to the end of ''acl.auth.php'': 
 + 
 +<code> 
 +* @VIEWER 1 
 +* @REPORTER 2 
 +* @UPDATER 4 
 +* @DEVELOPER 8 
 +* @MANAGER 16 
 +* @ADMINISTRATOR 16 
 +</code> 
 + 
 +This will get you startedSee the Tips section above for information about per-project group mappings. 
  
 ==== Mantis Authentication Backend (Single Sign-On) ==== ==== Mantis Authentication Backend (Single Sign-On) ====
Line 166: Line 224:
                         if ( !$silent )                         if ( !$silent )
                 {                    {   
-                    sg ( $lang [ 'badlogin' ], -1 );+                    msg ( $lang [ 'badlogin' ], -1 );
                 }                 }
                                  
Line 224: 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;
     }     }
 } }
-?> 
 </code> </code>
 This codes already contains the following mods: This codes already contains the following mods:
Line 232: Line 320:
   * Support logging in/out from DokuWiki's login page [[http://www.mantisbt.org/bugs/view.php?id=8277|Issue 8277]]   * Support logging in/out from DokuWiki's login page [[http://www.mantisbt.org/bugs/view.php?id=8277|Issue 8277]]
 If you want the original code, you can see the wiki history If you want the original code, you can see the wiki history
- 
- 
-==== Authorisation Configuration ==== 
- 
-You can set per project(namespace) user right as follows: 
-for each project the user has access on mantis it will be created a group: PROJECT_USERRIGHT 
-i.e 
-  my_namespace:my_project:* @ALL 0 
-  my_namespace:my_project:* @MYPROJECT_VIEWER 1 
-  my_namespace:my_project:* @MYPROJECT_DEVELOPER 8 
- 
-and you can still use the defaults. Follows a basic one acl.auth.php 
- 
-<code php conf\acl.auth.php> 
-# acl.auth.php 
-# <?php exit()?> 
-# Don't modify the lines above 
-# 
-# Access Control Lists 
-# 
-# Editing this file by hand shouldn't be necessary. Use the ACL 
-# Manager interface instead. 
-# 
-# If your auth backend allows special char like spaces in groups 
-# or user names you need to urlencode them (only chars <128, leave 
-# UTF-8 multibyte chars as is) 
-# 
-# none   0 
-# read   1 
-# edit   2 
-# create 4 
-# upload 8 
-# delete 16 
- 
-* @VIEWER 1 
-* @REPORTER 2 
-* @DEVELOPER 8 
-* @MANAGER 8 
-* @ADMINISTRATOR 8 
-* @ALL 0 
-</code> 
  
 ==== Mantis Syntax Plug-in ==== ==== Mantis Syntax Plug-in ====
Line 365: Line 412:
     }     }
 } }
-?> 
 </code> </code>
  
mantisbt/issue/7075/integration_with_dokuwiki.txt · Last modified: 2015/02/13 18:11 by dregad

Driven by DokuWiki