Rev 5902 | Rev 5931 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'=====================================================' Destroy Package' --- PROCESS FORM ---'=====================================================%><%Option explicit' Good idea to set when using redirectResponse.Expires = 0 ' always load the page, dont store%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/formating.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><!--#include file="common/common_dbedit.asp"--><!--#include file="common/daemon_instructions.asp"--><%'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><%'------------ Variable Definition -------------Dim ProblemsStringDim OverideWarningsDim bCanDeleteDim bCanDestroy'------------ Constants Declaration -----------'------------ Variable Init -------------------ProblemsString = NULLbCanDelete = FALSEbCanDestroy = canShowControlInProject ("DestroyPackage")OverideWarnings = "N"If bCanDestroy AND InStr( 1, Request("btn"), "YES", 1 ) > 0 Then OverideWarnings = "Y"'----------------------------------------------%><%Sub DestroyPackage ( nPvId, cOverrideWarnings, outProblemsString )OraDatabase.Parameters.Add "PV_ID", nPvId, ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "OVERRIDE_WARNINGS", cOverrideWarnings, ORAPARM_INPUT, ORATYPE_CHAROraDatabase.Parameters.Add "PROBLEM_STRING", NULL, ORAPARM_OUTPUT, ORATYPE_VARCHAR2objEH.TryORA ( OraSession )On Error Resume NextOraDatabase.ExecuteSQL _"BEGIN "&_" PK_PACKAGE.DESTROY_PACKAGE ( :PV_ID, :OVERRIDE_WARNINGS, :PROBLEM_STRING ); "&_"END; "objEH.CatchORA ( OraSession )outProblemsString = OraDatabase.Parameters("PROBLEM_STRING").ValueOraDatabase.Parameters.Remove "PV_ID"OraDatabase.Parameters.Remove "OVERRIDE_WARNINGS"OraDatabase.Parameters.Remove "PROBLEM_STRING"End Sub'-------------------------------------------------' Function: CanDestroyPackage' Description: Determine if the user can Destroy the specified Package' Match code in _version_browser'Function CanDestroyPackage(SSpv_id)Dim sqlStr, rsTempCanDestroyPackage = FALSEsqlStr = " SELECT PV.PV_ID," &_" PV.PKG_VERSION," &_" PV.DLOCKED," &_" PV.MODIFIED_STAMP," &_" pv.CREATOR_ID," &_" pv.OWNER_ID," &_" NVL2(rc.rtag_id,1,0) as inuse," &_" trunc(SYSDATE - pv.CREATED_STAMP + 0.5) as age" &_" FROM PACKAGE_VERSIONS PV," &_" RELEASE_CONTENT rc" &_" WHERE pv.PV_ID = :PV_ID" &_" AND pv.pv_id = rc.pv_id(+)"OraDatabase.Parameters.Add "PV_ID", SSpv_id, ORAPARM_INPUT, ORATYPE_NUMBERset rsTemp = OraDatabase.DbCreateDynaset( sqlStr, cint(0))If rsTemp.RecordCount <> 0 Then' User can try to delete package iff' Have suffiecient access (unusual)' They created it or own it' The version is not in use by any release (allow to be in pending or WIP)' [Not at the moment] The package was created less than xxxx days ago' Is not locked or Approved for AutobuildIf (objAccessControl.UserId = rsTemp("CREATOR_ID")) OR (objAccessControl.UserId = rsTemp("OWNER_ID")) ThenIf rsTemp("inuse") = 0 Then'If rsTemp("age") < 1000 ThenIf rsTemp("dlocked") <> "Y" Then'If rsTemp("dlocked") <> "A" ThenCanDestroyPackage = true'End IfEnd If'End IfEnd IfEnd IfEnd IfOraDatabase.Parameters.Remove "PV_ID"rsTemp.CloseSet rsTemp = nothingEnd Function%><%'----------------------- MAIN LINE ---------------------------' Setup persistance objectCall objPMod.StoreParameter ( "bfile", Request("bfile") )Call objPMod.StoreParameter ( "rfile", Request("rfile") )Call objPMod.StoreParameter ( "rtag_id", Request("rtag_id") )Call objPMod.StoreParameter ( "pv_id", Request("pv_id") )Call objPMod.StoreParameter ( "pkg_id", Request("pkg_id") )Call objPMod.StoreParameter ( "OLDpv_id", Request("OLDpv_id") )Call objPMod.StoreParameter ( "FLuser_name", Request("FLuser_name") )Call objPMod.StoreParameter ( "FLpkg_version", Request("FLpkg_version") )Call objPMod.StoreParameter ( "FLpkg_version", Request("FLpkg_version") )Call objPMod.StoreParameter ( "listby", Request("listby") )'' Ensure that the user can destroy the package' The user is known to be logged in' This page is not always called in the context of a 'Release'' ie: When called from the history page displayed from the Dangling Package Versions'' Allow to proceed' If the user can perform any action in the project' OR the package looks like they created it and it not in use'bCanDelete = bCanDestroyIf NOT bCanDelete ThenbCanDelete = CanDestroyPackage(objPMod.GetParamValue("pv_id"))End IfIf NOT bCanDelete ThenCall RaiseMsg(enum_MSG_ERROR, "You do not have access to delete this version of the package")End IfIf objPMod.GetParamValue("pv_id") ThenIf (DaemonInstructionPreventsEditing(Request("rtag_id"), Request("pv_id"))) ThenCall RaiseMsg(enum_MSG_ERROR, "This package version has one or more daemon instructions present.<br><br>"&_"Please delete them or allow them to be consumed before attempting to delete the package version.")Else'--- Process submition ---Call DestroyPackage ( objPMod.GetParamValue("pv_id"), OverideWarnings, ProblemsString )If IsNull( ProblemsString ) ThenResponse.Redirect( objPMod.GetParamValue("bfile") &"?DESTROYED=OK"& objPMod.ComposeURLWithout("bfile,pv_id") )End IfEnd IfElseErr.Raise 8, "This page requires more paramaters to run.<br>"& objPMod.ComposeURL()End If'----------------------------------------------------------------%><html><head><title>Release Manager</title><link rel="shortcut icon" href="<%=FavIcon%>"/><meta HTTP-EQUIV="Pragma" CONTENT="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="images/release_manager_style.css" type="text/css"><link rel="stylesheet" href="images/navigation.css" type="text/css"><script language="JavaScript" src="images/common.js"></script></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" ><!-- BODY ----><table width="100%" height="98%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" background="images/bg_form_lightgray.gif"><table width="650" border="0" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="left" valign="top" width="1%" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td><td background="images/lbox_bg_blue.gif"><!-- Heading --><img src="images/h_trsp_dot.gif" width="1" height="20"><!-- END Heading --></td><td align="right" valign="top" width="1%" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td></tr><tr><td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td><td bgcolor="#FFFFFF" valign="top"><!-- Body --><table width="100%" border="0" cellspacing="1" cellpadding="2"><form name="form" method="get" action="<%=ScriptName%>"><tr><td width="1%"><img src="images/h_trsp_dot.gif" width="1" height="10"></td><td width="1%" nowrap class="form_group" valign="bottom"></td><td nowrap width="100%" align="right" class="form_step"></td></tr><tr><td width="1%"> </td><td colspan="2" width="1%" nowrap class="form_field"><table width="100%" border="0" cellspacing="0" cellpadding="10"><tr><td background="images/bg_form_lightbluedark.gif"><p class="err_ttl">Please note:</p></td></tr><tr><td background="images/bg_form_lightgray.gif" class="form_item"><%' Format problem report string to htmlResponse.write Replace( Server.HTMLEncode( ProblemsString ), VBNewLine, "<br>" )%></td></tr><%If bCanDestroy Then %><tr><td background="images/bg_form_lightgray.gif" class="form_item"><%=enum_IMG_Critical%>Destroying this package may delete it from an SBOM or the dependency list of another package.<p>Do you still want to proceed ? </td></tr><%End If%></table></td></tr><tr><td width="1%"> </td><td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="1" height="1"></td><td nowrap width="100%" class="body_scol"><br><%If bCanDestroy Then %><input type="submit" name="btn" value=" Yes " class="form_btn"><input type="reset" name="btn" value=" No " class="form_btn" onClick="history.back();"><%End If%><input type="reset" name="btn" value="Cancel" class="form_btn" onClick="history.back();"><br><br></td></tr><%=objPMod.ComposeHiddenTags()%></form></table><!-- END Body--></td><td width="1%" background="images/lbox_bgside_white.gif"> </td></tr><tr><td width="1%" background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td><td background="images/lbox_bg_blue.gif"></td><td width="1%" background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td></tr></table></td></tr></table></td></tr></table></body></html><!-- DESTRUCTOR -------><!--#include file="common/destructor.asp"-->