Compare commits

..

14 Commits
0.7.1 ... 0.7.2

Author SHA1 Message Date
Denis Flaven
4f6af44591 - Bug fix: emailed URL was still wrong for lists of objects
SVN:0.7.2[82]
2009-07-18 13:27:05 +00:00
Denis Flaven
d8c1416162 - Bug fix: added the missing display template
SVN:0.7.2[81]
2009-07-16 06:49:33 +00:00
Denis Flaven
e89c7490a9 - The page was broken because there was no user login !
SVN:0.7.2[78]
2009-07-08 16:09:01 +00:00
Denis Flaven
38e00ab5e0 - Fixed location of the "audit" page in the menu. Was broken if iTop was not installed at the root of the web server.
SVN:0.7.2[77]
2009-07-08 16:07:51 +00:00
Denis Flaven
668e0308d8 Fixed bug #24: choice of organizations was limited to organization in "implementation".
SVN:0.7.2[76]
2009-07-08 15:05:54 +00:00
Denis Flaven
dee460d024 Incremented version number to 0.7.2
SVN:0.7.2[74]
2009-06-27 08:33:47 +00:00
Denis Flaven
d2fb28ed92 - bug fix: Ticket #1 (Life Cycle Schema not displayed)
SVN:0.7.2[73]
2009-06-27 08:32:46 +00:00
Denis Flaven
70bbd07973 - Bug fix: Ticket #2 (User rights not applied properly)
SVN:0.7.2[72]
2009-06-27 08:31:31 +00:00
Denis Flaven
4bdec745d2 - Bug fix: Ticket #2 (User rights not applied properly)
SVN:0.7.2[71]
2009-06-27 08:30:13 +00:00
Denis Flaven
3a99704d85 - Enhancement: display the current user's name in the top part of the window
SVN:0.7.2[70]
2009-06-27 08:28:58 +00:00
Denis Flaven
119755313f - Bug fix: Ticket #3 (email hyperlink was wrong)
SVN:0.7.2[69]
2009-06-27 08:27:44 +00:00
Denis Flaven
bdb000378a Fix for Ticket #22 (impossible to create change or incident tickets)
SVN:0.7.2[67]
2009-06-26 14:32:13 +00:00
Denis Flaven
b3996d150c - Fixed sample data
SVN:0.7.2[66]
2009-06-26 12:56:04 +00:00
Denis Flaven
7fd5007db5 Preparing release 0.7.2
SVN:0.7.2[65]
2009-06-26 12:42:51 +00:00
10 changed files with 45 additions and 20 deletions

View File

@@ -314,7 +314,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI
$oLogin = $oSet->Fetch();
if ($oLogin->Get('password') == $sPassword)
{
return true;
return $oLogin->Get('userid');
}
// todo: throw an exception?
return false;
@@ -326,7 +326,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI
return $oNullFilter;
}
public function IsActionAllowed($sUserName, $sClass, $iActionCode, dbObjectSet $aInstances)
public function IsActionAllowed($iUserId, $sClass, $iActionCode, dbObjectSet $aInstances)
{
if (!array_key_exists($iActionCode, self::$m_aActionCodes))
{
@@ -334,7 +334,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI
}
$sAction = self::$m_aActionCodes[$iActionCode];
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassGrant WHERE class = '$sClass' AND action = '$sAction' AND login = '$sUserName'"));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassGrant WHERE class = '$sClass' AND action = '$sAction' AND userid = '$iUserId'"));
if ($oSet->Count() < 1)
{
return UR_ALLOWED_NO;
@@ -354,7 +354,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI
return $iRetCode;
}
public function IsActionAllowedOnAttribute($sUserName, $sClass, $sAttCode, $iActionCode, dbObjectSet $aInstances)
public function IsActionAllowedOnAttribute($iUserId, $sClass, $sAttCode, $iActionCode, dbObjectSet $aInstances)
{
if (!array_key_exists($iActionCode, self::$m_aActionCodes))
{
@@ -362,7 +362,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI
}
$sAction = self::$m_aActionCodes[$iActionCode];
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixAttributeGrant WHERE UserRightsMatrixAttributeGrant.class = '$sClass' AND UserRightsMatrixAttributeGrant.attcode = '$sAttCode' AND UserRightsMatrixAttributeGrant.action = '$sAction' AND UserRightsMatrixAttributeGrant.login = '$sUserName'"));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixAttributeGrant WHERE UserRightsMatrixAttributeGrant.class = '$sClass' AND UserRightsMatrixAttributeGrant.attcode = '$sAttCode' AND UserRightsMatrixAttributeGrant.action = '$sAction' AND UserRightsMatrixAttributeGrant.userid = '$iUserId'"));
if ($oSet->Count() < 1)
{
return UR_ALLOWED_NO;
@@ -382,9 +382,9 @@ class UserRightsMatrix extends UserRightsAddOnAPI
return $iRetCode;
}
public function IsStimulusAllowed($sUserName, $sClass, $sStimulusCode, dbObjectSet $aInstances)
public function IsStimulusAllowed($iUserId, $sClass, $sStimulusCode, dbObjectSet $aInstances)
{
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '$sClass' AND stimulus = '$sStimulusCode' AND login = '$sUserName'"));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '$sClass' AND stimulus = '$sStimulusCode' AND userid = '$iUserId'"));
if ($oSet->Count() < 1)
{
return UR_ALLOWED_NO;

View File

@@ -612,7 +612,8 @@ class MenuBlock extends DisplayBlock
}
else
{
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("http://localhost:81/pages/UI.php?operation=search&filter=$sFilter&$sContext"));
$sUrl = self::GetAbsoluteUrl();
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("$sUrl?operation=search&filter=$sFilter&$sContext"));
$aActions[] = array ('label' => 'CSV Export', 'url' => "../pages/$sUIPage?operation=search&filter=$sFilter&format=csv&$sContext");
$aActions[] = array ('label' => 'Bookmark...', 'url' => "../pages/ajax.render.php?operation=create&class=$sClass&filter=$sFilter", 'class' => 'jqmTrigger');
if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'New...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); }
@@ -659,7 +660,8 @@ class MenuBlock extends DisplayBlock
else
{
// many objects in the set, possible actions are: new / modify all / delete all
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("http://localhost:81/pages/UI.php?operation=search&filter=$sFilter&$sContext"));
$sUrl = self::GetAbsoluteUrl();
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("$sUrl?operation=search&filter=$sFilter&$sContext"));
$aActions[] = array ('label' => 'CSV Export', 'url' => "../pages/$sUIPage?operation=search&filter=$sFilter&format=csv&$sContext");
$aActions[] = array ('label' => 'Bookmark...', 'url' => "../pages/ajax.render.php?operation=create&class=$sClass&filter=$sFilter", 'class' => 'jqmTrigger');
if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'New...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); }
@@ -676,7 +678,25 @@ class MenuBlock extends DisplayBlock
$sHtml .= "</ul>\n</li>\n</ul></div>\n";
$oPage->add_ready_script("$(\"ul.jd_menu\").jdMenu();\n");
return $sHtml;
}
}
static public function GetAbsoluteUrl()
{
// Build an absolute URL to this page on this server/port
$sServerName = $_SERVER['SERVER_NAME'];
$sProtocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
if ($sProtocol == 'http')
{
$sPort = ($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT'];
}
else
{
$sPort = ($_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
}
$sPath = $_SERVER['REQUEST_URI'];
$sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}";
return $sUrl;
}
}
?>

View File

@@ -255,7 +255,8 @@ EOF
$sText = "Your search";
$sOnClick = " onclick=\"this.value='';this.onclick=null;\"";
}
echo "<div id=\"OrganizationSelection\" style=\"position:absolute; top:18px; right:16px; width:400px;\">";
$sUserName = UserRights::GetUser();
echo "<div id=\"OrganizationSelection\" style=\"position:absolute; top:18px; right:16px; width:400px;\">Logged as '$sUserName'&nbsp;&nbsp;&nbsp;";
echo "<form action=\"../pages/UI.php\" style=\"display:inline\"><div style=\"padding:1px; background-color:#fff;display:inline;\"><img src=\"../images/magnifier.gif\"/><input style=\"border:0\" type=\"text\" size=\"15\" title=\"Global Search\" name=\"text\" value=\"$sText\"$sOnClick></input></div><input type=\"Submit\" value=\"Search\">
<input type=\"hidden\" name=\"operation\" value=\"full_text\"></form>\n";
echo "</div>\n";

View File

@@ -146,7 +146,7 @@ class logRealObject extends cmdbAbstractObject
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Common name", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"bizOrganization", "label"=>"Organization Id", "description"=>"ID of the object owner organization", "allowed_values"=>new ValueSetObjects("bizOrganization: status Contains 'implementation'", 'name', array('name'=>true)), "sql"=>"org_id", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"bizOrganization", "label"=>"Organization Id", "description"=>"ID of the object owner organization", "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("label"=>"Organization", "description"=>"Company / Department owning this object", "allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
MetaModel::Init_AddFilterFromAttribute("name");
@@ -1547,6 +1547,7 @@ class lnkClientServer extends logRealObject
"db_table" => "clientserver_links",
"db_key_field" => "link_id",
"db_finalclass_field" => "",
"display_template" => "../business/templates/default.html",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeExternalKey("client_id", array("targetclass"=>"bizApplication", "jointype"=> '', "label"=>"Client", "description"=>"The client part of the link", "allowed_values"=>null, "sql"=>"client_id", "is_null_allowed"=>false, "depends_on"=>array())));

View File

@@ -176,7 +176,7 @@ class UserRights
public static function GetFilter($sClass)
{
if (!MetaModel::HasCategory($sClass, 'bizModel')) return new DBObjectSearch($sClass);
if (!MetaModel::HasCategory($sClass, 'bizmodel')) return new DBObjectSearch($sClass);
if (!self::CheckLogin()) return false;
return self::$m_oAddOn->GetFilter(self::$m_iUserId, $sClass);
@@ -184,7 +184,7 @@ class UserRights
public static function IsActionAllowed($sClass, $iActionCode, dbObjectSet $aInstances)
{
if (!MetaModel::HasCategory($sClass, 'bizModel')) return true;
if (!MetaModel::HasCategory($sClass, 'bizmodel')) return true;
if (!self::CheckLogin()) return false;
return self::$m_oAddOn->IsActionAllowed(self::$m_iUserId, $sClass, $iActionCode, $aInstances);
@@ -192,7 +192,7 @@ class UserRights
public static function IsStimulusAllowed($sClass, $sStimulusCode, dbObjectSet $aInstances)
{
if (!MetaModel::HasCategory($sClass, 'bizModel')) return true;
if (!MetaModel::HasCategory($sClass, 'bizmodel')) return true;
if (!self::CheckLogin()) return false;
return self::$m_oAddOn->IsStimulusAllowed(self::$m_iUserId, $sClass, $sStimulusCode, $aInstances);
@@ -200,7 +200,7 @@ class UserRights
public static function IsActionAllowedOnAttribute($sClass, $sAttCode, $iActionCode, dbObjectSet $aInstances)
{
if (!MetaModel::HasCategory($sClass, 'bizModel')) return true;
if (!MetaModel::HasCategory($sClass, 'bizmodel')) return true;
if (!self::CheckLogin()) return false;
return self::$m_oAddOn->IsActionAllowedOnAttribute(self::$m_iUserId, $sClass, $sAttCode, $iActionCode, $aInstances);

View File

@@ -7,6 +7,9 @@ $currentOrganization = utils::ReadParam('org_id', '');
$operation = utils::ReadParam('operation', '');
$oAppContext = new ApplicationContext();
require_once('../application/loginwebpage.class.inc.php');
login_web_page::DoLogin(); // Check user rights and prompt if needed
$oP = new iTopWebPage("iTop - CMDB Audit", $currentOrganization);
function GetRuleResultSet($iRuleId, $oDefinitionFilter)

View File

@@ -160,7 +160,7 @@ function DisplayLifecycle($oPage, $sClass)
{
$aStates = MetaModel::EnumStates($sClass);
$aStimuli = MetaModel::EnumStimuli($sClass);
$oPage->add("<img src=\"/pages/graphviz.php?class=$sClass\">\n");
$oPage->add("<img src=\"../pages/graphviz.php?class=$sClass\">\n");
$oPage->add("<h3>Transitions</h3>\n");
$oPage->add("<ul>\n");
foreach ($aStates as $sStateCode => $aStateDef)

View File

@@ -17,7 +17,7 @@
<email>alexandre.dumas@gmail.com</email>
<phone></phone>
<location_id>1</location_id>
<first_name>Alexandre</first_name>
<first_name>Dumas</first_name>
<employe_number></employe_number>
</bizPerson>
<bizPerson id="7">

View File

@@ -151,7 +151,7 @@
<parent_id>1</parent_id>
<name>Audit</name>
<label>Audit</label>
<hyperlink>/pages/audit.php</hyperlink>
<hyperlink>./audit.php</hyperlink>
<template></template>
<rank>4</rank>
<type>application</type>
@@ -592,7 +592,7 @@ text-align:center;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:32px;&quot;&gt;Welcome to iTop&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:14px;&quot;&gt;&lt;i&gt;Version 0.7.1&lt;/i&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:14px;&quot;&gt;&lt;i&gt;Version 0.7.2&lt;/i&gt;&lt;/p&gt;
</template>
<rank>1</rank>