2005-02-04 15:30:38 +01:00
< ? php
/* Copyright ( C ) 2002 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2002 - 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2012-07-27 18:41:52 +02:00
* Copyright ( C ) 2004 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2005-02-04 15:30:38 +01:00
* Copyright ( C ) 2004 Eric Seigne < eric . seigne @ ryxeo . com >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
2012-10-04 18:40:05 +02:00
* Copyright ( C ) 2012 Juanjo Menent < jmenent @ 2 byte . es >
2005-02-04 15:30:38 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2005-02-04 15:30:38 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2005-02-04 15:30:38 +01:00
*/
2005-03-06 16:39:32 +01:00
/**
2008-08-19 22:09:53 +02:00
* \file htdocs / user / perms . php
* \brief Onglet user et permissions de la fiche utilisateur
*/
2005-02-04 15:30:38 +01:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/usergroups.lib.php' ;
2013-01-10 08:27:12 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
2005-02-04 15:30:38 +01:00
$langs -> load ( " users " );
2008-01-22 21:23:51 +01:00
$langs -> load ( " admin " );
2005-02-04 15:30:38 +01:00
2012-01-11 15:07:17 +01:00
$id = GETPOST ( 'id' , 'int' );
$action = GETPOST ( 'action' , 'alpha' );
$confirm = GETPOST ( 'confirm' , 'alpha' );
2012-10-20 09:33:39 +02:00
$module = GETPOST ( 'module' , 'alpha' );
$rights = GETPOST ( 'rights' , 'int' );
2012-09-27 11:54:51 +02:00
$entity = ( GETPOST ( 'entity' , 'int' ) ? GETPOST ( 'entity' , 'int' ) : $conf -> entity );
2005-02-04 15:30:38 +01:00
2011-08-21 02:20:43 +02:00
if ( ! isset ( $id ) || empty ( $id )) accessforbidden ();
2006-11-26 20:19:46 +01:00
2010-10-28 21:31:11 +02:00
// Defini si peux lire les permissions
2010-11-08 12:40:52 +01:00
$canreaduser = ( $user -> admin || $user -> rights -> user -> user -> lire );
2010-10-28 21:31:11 +02:00
// Defini si peux modifier les autres utilisateurs et leurs permisssions
2005-10-22 15:48:19 +02:00
$caneditperms = ( $user -> admin || $user -> rights -> user -> user -> creer );
2010-11-08 12:40:52 +01:00
// Advanced permissions
if ( ! empty ( $conf -> global -> MAIN_USE_ADVANCED_PERMS ))
{
$canreaduser = ( $user -> admin || ( $user -> rights -> user -> user -> lire && $user -> rights -> user -> user_advance -> readperms ));
2011-08-21 02:20:43 +02:00
$caneditselfperms = ( $user -> id == $id && $user -> rights -> user -> self_advance -> writeperms );
2012-05-07 11:15:14 +02:00
$caneditperms = (( $caneditperms || $caneditselfperms ) ? 1 : 0 );
2010-11-08 12:40:52 +01:00
}
2010-10-28 21:31:11 +02:00
2009-08-06 15:07:25 +02:00
// Security check
$socid = 0 ;
2012-07-10 13:20:53 +02:00
if ( isset ( $user -> societe_id ) && $user -> societe_id > 0 ) $socid = $user -> societe_id ;
2009-08-06 15:07:25 +02:00
$feature2 = (( $socid && $user -> rights -> user -> self -> creer ) ? '' : 'user' );
2012-03-23 00:27:12 +01:00
if ( $user -> id == $id && ( empty ( $conf -> global -> MAIN_USE_ADVANCED_PERMS ) || $user -> rights -> user -> self_advance -> readperms )) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms
2009-08-17 19:32:38 +02:00
{
$feature2 = '' ;
$canreaduser = 1 ;
}
2013-05-03 16:10:28 +02:00
2012-01-11 15:07:17 +01:00
$result = restrictedArea ( $user , 'user' , $id , '&user' , $feature2 );
2011-08-21 02:20:43 +02:00
if ( $user -> id <> $id && ! $canreaduser ) accessforbidden ();
2005-10-22 15:48:19 +02:00
2005-02-04 15:30:38 +01:00
/**
* Actions
*/
2012-07-27 18:41:52 +02:00
2011-08-21 02:20:43 +02:00
if ( $action == 'addrights' && $caneditperms )
2005-02-04 15:30:38 +01:00
{
2010-05-02 08:39:40 +02:00
$edituser = new User ( $db );
2011-08-21 02:20:43 +02:00
$edituser -> fetch ( $id );
2013-12-15 14:26:27 +01:00
//$edituser->addrights($rights, $module, '', $entity); // TODO unused for the moment
2012-09-27 11:54:51 +02:00
$edituser -> addrights ( $rights , $module );
2006-11-26 20:19:46 +01:00
2008-01-08 09:14:20 +01:00
// Si on a touche a ses propres droits, on recharge
2011-08-21 02:20:43 +02:00
if ( $id == $user -> id )
2006-11-26 20:19:46 +01:00
{
$user -> clearrights ();
$user -> getrights ();
2013-04-12 14:27:41 +02:00
$menumanager -> loadMenu ();
2006-11-26 20:19:46 +01:00
}
2005-02-04 15:30:38 +01:00
}
2011-08-21 02:20:43 +02:00
if ( $action == 'delrights' && $caneditperms )
2005-02-04 15:30:38 +01:00
{
2010-05-02 08:39:40 +02:00
$edituser = new User ( $db );
2011-08-21 02:20:43 +02:00
$edituser -> fetch ( $id );
2013-12-15 14:26:27 +01:00
//$edituser->delrights($rights, $module, '', $entity); // TODO unused for the moment
2012-09-27 11:54:51 +02:00
$edituser -> delrights ( $rights , $module );
2006-11-26 20:19:46 +01:00
2008-01-08 09:14:20 +01:00
// Si on a touche a ses propres droits, on recharge
2011-08-21 02:20:43 +02:00
if ( $id == $user -> id )
2006-11-26 20:19:46 +01:00
{
$user -> clearrights ();
$user -> getrights ();
2013-04-12 14:27:41 +02:00
$menumanager -> loadMenu ();
2006-11-26 20:19:46 +01:00
}
2005-02-04 15:30:38 +01:00
}
2012-07-27 18:41:52 +02:00
/**
* View
*/
2005-02-04 15:30:38 +01:00
2008-01-06 13:57:09 +01:00
llxHeader ( '' , $langs -> trans ( " Permissions " ));
$form = new Form ( $db );
2010-04-28 09:31:34 +02:00
$fuser = new User ( $db );
2011-08-21 02:20:43 +02:00
$fuser -> fetch ( $id );
2006-11-26 20:19:46 +01:00
$fuser -> getrights ();
2005-03-06 16:39:32 +01:00
2006-11-26 20:19:46 +01:00
$head = user_prepare_head ( $fuser );
2005-03-06 16:39:32 +01:00
2009-05-05 02:25:14 +02:00
$title = $langs -> trans ( " User " );
2009-08-05 19:19:55 +02:00
dol_fiche_head ( $head , 'rights' , $title , 0 , 'user' );
2005-03-06 17:01:38 +01:00
2005-02-04 15:30:38 +01:00
2006-11-26 20:19:46 +01:00
$db -> begin ();
2005-04-09 19:52:38 +02:00
2010-07-15 10:42:05 +02:00
// Search all modules with permission and reload permissions def.
2006-11-26 20:19:46 +01:00
$modules = array ();
2012-05-08 22:49:03 +02:00
$modulesdir = dolGetModulesDirs ();
2009-05-05 02:25:14 +02:00
2011-08-01 15:15:53 +02:00
foreach ( $modulesdir as $dir )
{
2012-05-08 22:49:03 +02:00
$handle =@ opendir ( dol_osencode ( $dir ));
2010-12-15 19:15:08 +01:00
if ( is_resource ( $handle ))
{
2011-09-20 17:41:16 +02:00
while (( $file = readdir ( $handle )) !== false )
2010-12-15 19:15:08 +01:00
{
if ( is_readable ( $dir . $file ) && substr ( $file , 0 , 3 ) == 'mod' && substr ( $file , dol_strlen ( $file ) - 10 ) == '.class.php' )
{
$modName = substr ( $file , 0 , dol_strlen ( $file ) - 10 );
if ( $modName )
{
2012-08-23 02:04:35 +02:00
include_once $dir . $file ;
2010-12-15 19:15:08 +01:00
$objMod = new $modName ( $db );
2011-08-24 00:25:37 +02:00
2011-03-14 13:00:42 +01:00
// Load all lang files of module
if ( isset ( $objMod -> langfiles ) && is_array ( $objMod -> langfiles ))
{
foreach ( $objMod -> langfiles as $domain )
{
$langs -> load ( $domain );
}
}
// Load all permissions
2011-08-24 00:25:37 +02:00
if ( $objMod -> rights_class )
{
2012-09-27 11:54:51 +02:00
$forceEntity = (( ! empty ( $conf -> multicompany -> enabled ) && ! empty ( $fuser -> entity )) ? $fuser -> entity : null );
$ret = $objMod -> insert_permissions ( 0 , $forceEntity );
2010-12-15 19:15:08 +01:00
$modules [ $objMod -> rights_class ] = $objMod ;
//print "modules[".$objMod->rights_class."]=$objMod;";
}
}
}
}
}
2006-11-26 20:19:46 +01:00
}
2005-04-09 19:52:38 +02:00
2006-11-26 20:19:46 +01:00
$db -> commit ();
2005-02-04 15:30:38 +01:00
2006-11-26 20:19:46 +01:00
// Lecture des droits utilisateurs
$permsuser = array ();
2005-03-06 16:39:32 +01:00
2009-04-27 22:37:50 +02:00
$sql = " SELECT r.id, r.libelle, r.module " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " rights_def as r, " ;
$sql .= " " . MAIN_DB_PREFIX . " user_rights as ur " ;
$sql .= " WHERE ur.fk_id = r.id " ;
2013-12-15 14:26:27 +01:00
if ( ! empty ( $conf -> multicompany -> enabled ))
{
2012-09-27 11:54:51 +02:00
if ( 1 == 2 && ! empty ( $conf -> multicompany -> transverse_mode )) {
2013-12-15 14:26:27 +01:00
$sql .= " AND r.entity = " . ( GETPOST ( 'entity' , 'int' ) ? GETPOST ( 'entity' , 'int' ) : $conf -> entity ); // TODO unused for the moment
2012-09-27 11:54:51 +02:00
} else {
$sql .= " AND r.entity = " . ( ! empty ( $fuser -> entity ) ? $fuser -> entity : $conf -> entity );
}
2013-12-15 14:26:27 +01:00
}
else
{
2012-09-27 11:54:51 +02:00
$sql .= " AND r.entity = " . $conf -> entity ;
}
2009-04-27 22:37:50 +02:00
$sql .= " AND ur.fk_user = " . $fuser -> id ;
2006-11-26 20:19:46 +01:00
2013-04-12 14:27:41 +02:00
dol_syslog ( " get user perms sql= " . $sql );
2006-11-26 20:19:46 +01:00
$result = $db -> query ( $sql );
if ( $result )
{
$num = $db -> num_rows ( $result );
$i = 0 ;
while ( $i < $num )
2005-02-04 15:30:38 +01:00
{
2006-11-26 20:19:46 +01:00
$obj = $db -> fetch_object ( $result );
array_push ( $permsuser , $obj -> id );
$i ++ ;
2005-03-06 16:39:32 +01:00
}
2006-11-26 20:19:46 +01:00
$db -> free ( $result );
}
else
{
2009-02-20 23:53:15 +01:00
dol_print_error ( $db );
2006-11-26 20:19:46 +01:00
}
2005-03-06 16:39:32 +01:00
2006-11-26 20:19:46 +01:00
// Lecture des droits groupes
2012-09-27 11:54:51 +02:00
$permsgroupbyentity = array ();
$aEntities = array ();
2005-02-04 15:30:38 +01:00
2012-09-27 11:54:51 +02:00
$sql = " SELECT r.id, r.libelle, r.module, gu.entity " ;
2009-04-27 22:37:50 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " rights_def as r, " ;
$sql .= " " . MAIN_DB_PREFIX . " usergroup_rights as gr, " ;
$sql .= " " . MAIN_DB_PREFIX . " usergroup_user as gu " ;
$sql .= " WHERE gr.fk_id = r.id " ;
2012-09-27 11:54:51 +02:00
if ( ! empty ( $conf -> multicompany -> enabled ) && ! empty ( $conf -> multicompany -> transverse_mode )) {
$sql .= " AND gu.entity IS NOT NULL " ;
} else {
$sql .= " AND r.entity = " . (( ! empty ( $conf -> multicompany -> enabled ) && ! empty ( $fuser -> entity )) ? $fuser -> entity : $conf -> entity );
}
2009-04-27 22:37:50 +02:00
$sql .= " AND gr.fk_usergroup = gu.fk_usergroup " ;
$sql .= " AND gu.fk_user = " . $fuser -> id ;
2005-02-04 15:30:38 +01:00
2013-04-12 14:27:41 +02:00
dol_syslog ( " get user perms sql= " . $sql );
2006-11-26 20:19:46 +01:00
$result = $db -> query ( $sql );
if ( $result )
{
$num = $db -> num_rows ( $result );
$i = 0 ;
while ( $i < $num )
2005-02-04 15:30:38 +01:00
{
2006-11-26 20:19:46 +01:00
$obj = $db -> fetch_object ( $result );
2012-09-27 11:54:51 +02:00
if ( ! isset ( $permsgroupbyentity [ $obj -> entity ]))
$permsgroupbyentity [ $obj -> entity ] = array ();
array_push ( $permsgroupbyentity [ $obj -> entity ], $obj -> id );
2006-11-26 20:19:46 +01:00
$i ++ ;
2005-02-04 15:30:38 +01:00
}
2006-11-26 20:19:46 +01:00
$db -> free ( $result );
}
else
{
2009-02-20 23:53:15 +01:00
dol_print_error ( $db );
2006-11-26 20:19:46 +01:00
}
2005-02-04 15:30:38 +01:00
2006-11-26 20:19:46 +01:00
/*
* Ecran ajout / suppression permission
*/
2005-02-04 15:30:38 +01:00
2007-09-01 00:06:14 +02:00
print '<table class="border" width="100%">' ;
// Ref
print '<tr><td width="25%" valign="top">' . $langs -> trans ( " Ref " ) . '</td>' ;
2010-12-27 19:03:02 +01:00
print '<td>' ;
2007-09-01 00:06:14 +02:00
print $form -> showrefnav ( $fuser , 'id' , '' , $user -> rights -> user -> user -> lire || $user -> admin );
print '</td>' ;
2010-12-27 19:03:02 +01:00
print '</tr>' . " \n " ;
2007-09-01 00:06:14 +02:00
2013-01-02 18:43:59 +01:00
// Lastname
2007-09-01 00:06:14 +02:00
print '<tr><td width="25%" valign="top">' . $langs -> trans ( " Lastname " ) . '</td>' ;
2013-04-17 21:14:46 +02:00
print '<td>' . $fuser -> lastname . '</td>' ;
2010-12-27 19:03:02 +01:00
print '</tr>' . " \n " ;
2007-09-01 00:06:14 +02:00
2013-01-02 18:43:59 +01:00
// Firstname
2007-09-01 00:06:14 +02:00
print '<tr><td width="25%" valign="top">' . $langs -> trans ( " Firstname " ) . '</td>' ;
2013-02-23 15:26:39 +01:00
print '<td>' . $fuser -> firstname . '</td>' ;
2010-12-27 19:03:02 +01:00
print '</tr>' . " \n " ;
2007-09-01 00:06:14 +02:00
print '</table><br>' ;
2013-01-02 18:43:59 +01:00
if ( $user -> admin ) print info_admin ( $langs -> trans ( " WarningOnlyPermissionOfActivatedModules " ), 0 , 1 ) . '<br>' ;
2013-06-05 16:12:07 +02:00
// Show warning about external users
if ( empty ( $user -> societe_id )) print showModulesExludedForExternal ( $modules ) . '<br><br>' . " \n " ;
2007-09-01 00:06:14 +02:00
2012-09-27 11:54:51 +02:00
// For multicompany transversal mode
if ( ! empty ( $conf -> multicompany -> enabled ) && ! empty ( $conf -> multicompany -> transverse_mode ))
{
2012-09-30 21:26:58 +02:00
$aEntities = array_keys ( $permsgroupbyentity );
2012-09-27 11:54:51 +02:00
sort ( $aEntities );
2012-09-30 21:26:58 +02:00
$entity = ( GETPOST ( 'entity' , 'int' ) ? GETPOST ( 'entity' , 'int' ) : $aEntities [ 0 ]);
2012-09-27 11:54:51 +02:00
$head = entity_prepare_head ( $fuser , $aEntities );
2012-09-30 21:26:58 +02:00
$title = $langs -> trans ( " Entities " );
2012-09-27 11:54:51 +02:00
dol_fiche_head ( $head , $entity , $title , 1 , 'multicompany@multicompany' );
}
2010-12-27 19:03:02 +01:00
print " \n " ;
2006-11-26 20:19:46 +01:00
print '<table width="100%" class="noborder">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " Module " ) . '</td>' ;
2012-09-30 21:26:58 +02:00
if ( $caneditperms ) print '<td> </td>' ;
2006-11-26 20:19:46 +01:00
print '<td align="center" width="24"> </td>' ;
print '<td>' . $langs -> trans ( " Permissions " ) . '</td>' ;
2010-12-27 19:03:02 +01:00
print '</tr>' . " \n " ;
2006-11-26 20:19:46 +01:00
2011-05-05 09:02:22 +02:00
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
2009-04-27 22:37:50 +02:00
$sql = " SELECT r.id, r.libelle, r.module " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " rights_def as r " ;
$sql .= " WHERE r.libelle NOT LIKE 'tou%' " ; // On ignore droits "tous"
2011-09-06 21:58:23 +02:00
$sql .= " AND r.entity = " . (( ! empty ( $conf -> multicompany -> enabled ) && ! empty ( $fuser -> entity )) ? $fuser -> entity : $conf -> entity );
2010-11-08 12:40:52 +01:00
if ( empty ( $conf -> global -> MAIN_USE_ADVANCED_PERMS )) $sql .= " AND r.perms NOT LIKE '%_advance' " ; // Hide advanced perms if option is disable
2009-04-27 22:37:50 +02:00
$sql .= " ORDER BY r.module, r.id " ;
2006-11-26 20:19:46 +01:00
$result = $db -> query ( $sql );
if ( $result )
{
$num = $db -> num_rows ( $result );
$i = 0 ;
$var = True ;
2012-07-10 13:20:53 +02:00
$oldmod = '' ;
2011-08-24 00:25:37 +02:00
2006-11-26 20:19:46 +01:00
while ( $i < $num )
{
$obj = $db -> fetch_object ( $result );
2005-02-04 15:30:38 +01:00
2006-11-26 20:19:46 +01:00
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
2012-07-10 13:20:53 +02:00
if ( empty ( $modules [ $obj -> module ]))
2006-11-26 20:19:46 +01:00
{
$i ++ ;
continue ;
}
2005-03-06 16:39:32 +01:00
2012-09-30 21:26:58 +02:00
if ( isset ( $obj -> module ) && ( $oldmod <> $obj -> module ))
{
$oldmod = $obj -> module ;
$var = ! $var ;
// Rupture detectee, on recupere objMod
$objMod = $modules [ $obj -> module ];
$picto = ( $objMod -> picto ? $objMod -> picto : 'generic' );
if ( $caneditperms && ( empty ( $objMod -> rights_admin_allowed ) || empty ( $fuser -> admin )))
{
// On affiche ligne pour modifier droits
2012-09-27 11:54:51 +02:00
print '<tr ' . $bc [ $var ] . '>' ;
2013-04-25 01:13:13 +02:00
print '<td class="nowrap">' . img_object ( '' , $picto ) . ' ' . $objMod -> getName ();
2012-09-27 11:54:51 +02:00
print '<a name="' . $objMod -> getName () . '"> </a></td>' ;
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2012-09-30 21:26:58 +02:00
print '<a title="' . dol_escape_htmltag ( $langs -> trans ( " All " )) . '" alt="' . dol_escape_htmltag ( $langs -> trans ( " All " )) . '" href="perms.php?id=' . $fuser -> id . '&action=addrights&entity=' . $entity . '&module=' . $obj -> module . '#' . $objMod -> getName () . '">' . $langs -> trans ( " All " ) . " </a> " ;
print '/' ;
print '<a title="' . dol_escape_htmltag ( $langs -> trans ( " None " )) . '" alt="' . dol_escape_htmltag ( $langs -> trans ( " None " )) . '" href="perms.php?id=' . $fuser -> id . '&action=delrights&entity=' . $entity . '&module=' . $obj -> module . '#' . $objMod -> getName () . '">' . $langs -> trans ( " None " ) . " </a> " ;
print '</td>' ;
print '<td colspan="2"> </td>' ;
print '</tr>' . " \n " ;
}
2006-11-26 20:19:46 +01:00
}
2005-03-06 16:39:32 +01:00
2006-11-26 20:19:46 +01:00
print '<tr ' . $bc [ $var ] . '>' ;
2005-04-02 00:30:25 +02:00
2010-12-27 19:03:02 +01:00
// Picto and label of permission
2012-09-27 11:54:51 +02:00
print '<td>' . img_object ( '' , $picto ) . ' ' . $objMod -> getName () . '</td>' ;
2012-09-30 21:26:58 +02:00
// Permission and tick
if ( ! empty ( $fuser -> admin ) && ! empty ( $objMod -> rights_admin_allowed )) // Permission own because admin
{
if ( $caneditperms )
{
print '<td align="center">' . img_picto ( $langs -> trans ( " Administrator " ), 'star' ) . '</td>' ;
}
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2012-09-30 21:26:58 +02:00
print img_picto ( $langs -> trans ( " Active " ), 'tick' );
print '</td>' ;
}
else if ( in_array ( $obj -> id , $permsuser )) // Permission own by user
{
if ( $caneditperms )
{
print '<td align="center"><a href="perms.php?id=' . $fuser -> id . '&action=delrights&rights=' . $obj -> id . '#' . $objMod -> getName () . '">' . img_edit_remove ( $langs -> trans ( " Remove " )) . '</a></td>' ;
}
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2012-09-30 21:26:58 +02:00
print img_picto ( $langs -> trans ( " Active " ), 'tick' );
print '</td>' ;
}
2013-01-02 18:43:59 +01:00
2012-10-04 18:40:05 +02:00
else if ( is_array ( $permsgroupbyentity [ $entity ]))
2012-09-30 21:26:58 +02:00
{
2012-10-04 18:40:05 +02:00
if ( in_array ( $obj -> id , $permsgroupbyentity [ $entity ])) // Permission own by group
{
if ( $caneditperms )
{
print '<td align="center">' ;
print $form -> textwithtooltip ( $langs -> trans ( " Inherited " ), $langs -> trans ( " PermissionInheritedFromAGroup " ));
print '</td>' ;
}
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2012-10-04 18:40:05 +02:00
print img_picto ( $langs -> trans ( " Active " ), 'tick' );
print '</td>' ;
}
2013-01-16 18:58:39 +01:00
else
{
// Do not own permission
if ( $caneditperms )
{
print '<td align="center"><a href="perms.php?id=' . $fuser -> id . '&action=addrights&entity=' . $entity . '&rights=' . $obj -> id . '#' . $objMod -> getName () . '">' . img_edit_add ( $langs -> trans ( " Add " )) . '</a></td>' ;
}
print '<td> </td>' ;
}
2012-09-30 21:26:58 +02:00
}
else
{
// Do not own permission
if ( $caneditperms )
{
print '<td align="center"><a href="perms.php?id=' . $fuser -> id . '&action=addrights&entity=' . $entity . '&rights=' . $obj -> id . '#' . $objMod -> getName () . '">' . img_edit_add ( $langs -> trans ( " Add " )) . '</a></td>' ;
}
print '<td> </td>' ;
2006-11-26 20:19:46 +01:00
}
2005-03-06 16:39:32 +01:00
2010-11-08 13:06:25 +01:00
$perm_libelle = ( $conf -> global -> MAIN_USE_ADVANCED_PERMS && ( $langs -> trans ( " PermissionAdvanced " . $obj -> id ) != ( " PermissionAdvanced " . $obj -> id )) ? $langs -> trans ( " PermissionAdvanced " . $obj -> id ) : (( $langs -> trans ( " Permission " . $obj -> id ) != ( " Permission " . $obj -> id )) ? $langs -> trans ( " Permission " . $obj -> id ) : $obj -> libelle ));
2006-11-26 20:19:46 +01:00
print '<td>' . $perm_libelle . '</td>' ;
2005-03-06 16:39:32 +01:00
2010-12-27 19:03:02 +01:00
print '</tr>' . " \n " ;
2005-03-06 16:39:32 +01:00
2006-11-26 20:19:46 +01:00
$i ++ ;
2005-02-04 15:30:38 +01:00
}
}
2011-08-24 00:25:37 +02:00
else dol_print_error ( $db );
2006-11-26 20:19:46 +01:00
print '</table>' ;
2005-03-06 16:39:32 +01:00
2005-02-04 15:30:38 +01:00
2012-07-27 18:41:52 +02:00
dol_fiche_end ();
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-03-23 00:27:12 +01:00
$db -> close ();