Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
ab1d4b33
Commit
ab1d4b33
authored
13 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Delete of security event keep add a delete event
parent
44966651
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/admin/events.php
+20
-54
20 additions, 54 deletions
htdocs/admin/events.php
htdocs/admin/tools/listevents.php
+39
-14
39 additions, 14 deletions
htdocs/admin/tools/listevents.php
htdocs/core/class/events.class.php
+37
-2
37 additions, 2 deletions
htdocs/core/class/events.class.php
with
96 additions
and
70 deletions
htdocs/admin/events.php
+
20
−
54
View file @
ab1d4b33
...
...
@@ -20,16 +20,17 @@
* \file htdocs/admin/events.php
* \ingroup core
* \brief Log event setup page
* \version $Id$
* \version $Id
: events.php,v 1.20 2011/07/18 23:30:56 eldy Exp
$
*/
require
(
"../main.inc.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/lib/admin.lib.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/lib/agenda.lib.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/core/class/events.class.php"
);
if
(
!
$user
->
admin
)
accessforbidden
();
accessforbidden
();
$langs
->
load
(
"users"
);
$langs
->
load
(
"admin"
);
...
...
@@ -38,52 +39,19 @@ $langs->load("other");
$action
=
GETPOST
(
"action"
);
// List of all events supported by triggers
$eventstolog
=
array
(
array
(
'id'
=>
'USER_LOGIN'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_LOGIN_FAILED'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_LOGOUT'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_CREATE'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_MODIFY'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_NEW_PASSWORD'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_ENABLEDISABLE'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_DELETE'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_CREATE'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_MODIFY'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_DELETE'
,
'test'
=>
1
),
/* array('id'=>'ACTION_CREATE', 'test'=>$conf->societe->enabled),
array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled),
array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled),
array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_CLOSE_SIGNED', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_CLOSE_REFUSED', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_SENTBYMAIL', 'test'=>$conf->propal->enabled),
array('id'=>'ORDER_VALIDATE', 'test'=>$conf->commande->enabled),
array('id'=>'ORDER_SENTBYMAIL', 'test'=>$conf->commande->enabled),
array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_CANCEL', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled),
array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled),
array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled),
array('id'=>'MEMBER_CREATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_VALIDATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_SUBSCRIPTION', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_MODIFY', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_RESILIATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_DELETE', 'test'=>$conf->adherent->enabled),
*/
);
$securityevent
=
new
Events
(
$db
);
$eventstolog
=
$securityevent
->
eventstolog
;
/*
* Actions
*/
* Actions
*/
if
(
$action
==
"save"
)
{
$i
=
0
;
$i
=
0
;
$db
->
begin
();
$db
->
begin
();
foreach
(
$eventstolog
as
$key
=>
$arr
)
{
...
...
@@ -93,8 +61,8 @@ if ($action == "save")
else
dolibarr_del_const
(
$db
,
$param
,
$conf
->
entity
);
}
$db
->
commit
();
$mesg
=
"<font class=
\"
ok
\"
>"
.
$langs
->
trans
(
"SetupSaved"
)
.
"</font>"
;
$db
->
commit
();
$mesg
=
"<font class=
\"
ok
\"
>"
.
$langs
->
trans
(
"SetupSaved"
)
.
"</font>"
;
}
...
...
@@ -130,14 +98,14 @@ foreach ($eventstolog as $key => $arr)
{
if
(
$arr
[
'id'
])
{
$var
=!
$var
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
.
$arr
[
'id'
]
.
'</td>'
;
print
'<td>'
;
$key
=
'MAIN_LOGEVENTS_'
.
$arr
[
'id'
];
$var
=!
$var
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
.
$arr
[
'id'
]
.
'</td>'
;
print
'<td>'
;
$key
=
'MAIN_LOGEVENTS_'
.
$arr
[
'id'
];
$value
=
$conf
->
global
->
$key
;
print
'<input '
.
$bc
[
$var
]
.
' type="checkbox" name="'
.
$key
.
'" value="1"'
.
(
$value
?
' checked="true"'
:
''
)
.
'>'
;
print
'</td></tr>'
.
"
\n
"
;
print
'</td></tr>'
.
"
\n
"
;
}
}
print
'</table>'
;
...
...
@@ -151,12 +119,10 @@ print "</form>\n";
print
'</div>'
;
if
(
$mesg
)
print
"<br>
$mesg
<br>"
;
print
"<br>"
;
dol_htmloutput_mesg
(
$mesg
);
$db
->
close
();
llxFooter
(
'$Date$ - $Revision$'
);
llxFooter
(
'$Date
: 2011/07/18 23:30:56
$ - $Revision
: 1.20
$'
);
?>
This diff is collapsed.
Click to expand it.
htdocs/admin/tools/listevents.php
+
39
−
14
View file @
ab1d4b33
...
...
@@ -21,19 +21,19 @@
* \file htdocs/admin/tools/listevents.php
* \ingroup core
* \brief List of security events
* \version $Id$
* \version $Id
: listevents.php,v 1.31 2011/07/18 23:28:30 eldy Exp
$
*/
require
(
"../../main.inc.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
'/core/class/events.class.php'
);
if
(
!
$user
->
admin
)
accessforbidden
();
accessforbidden
();
// Security check
if
(
$user
->
societe_id
>
0
)
{
$action
=
''
;
$socid
=
$user
->
societe_id
;
$action
=
''
;
$socid
=
$user
->
societe_id
;
}
$langs
->
load
(
"admin"
);
...
...
@@ -61,23 +61,48 @@ $search_ua = GETPOST("search_ua");
* Actions
*/
$now
=
dol_now
();
// Purge audit events
if
(
$_REQUEST
[
'action'
]
==
'confirm_purge'
&&
$_REQUEST
[
'confirm'
]
==
'yes'
&&
$user
->
admin
)
{
$error
=
0
;
$db
->
begin
();
$securityevents
=
new
Events
(
$db
);
// Delete events
$sql
=
"DELETE FROM "
.
MAIN_DB_PREFIX
.
"events"
;
$sql
.
=
" WHERE entity = "
.
$conf
->
entity
;
$resql
=
$db
->
query
(
$sql
);
if
(
!
$resql
)
{
$error
++
;
$mesg
=
'<div class="error">'
.
$db
->
lasterror
()
.
'</div>'
;
}
// Add event purge
$text
=
$langs
->
trans
(
"SecurityEventsPurged"
);
$securityevent
=
new
Events
(
$db
);
$securityevent
->
type
=
'SECURITY_EVENTS_PURGE'
;
$securityevent
->
dateevent
=
$now
;
$securityevent
->
description
=
$text
;
$result
=
$securityevent
->
create
(
$user
);
if
(
$result
>
0
)
{
dol_syslog
(
$text
,
LOG_WARNING
);
}
else
{
$error
++
;
dol_syslog
(
$securityevent
->
error
,
LOG_ERROR
);
$db
->
rolback
();
}
}
/*
* View
*/
* View
*/
llxHeader
();
...
...
@@ -215,21 +240,21 @@ if ($result)
else
print
'<tr><td colspan="6">'
.
$langs
->
trans
(
"NoEventOrNoAuditSetup"
)
.
'</td></tr>'
;
}
print
"</table>"
;
$db
->
free
();
$db
->
free
(
$result
);
if
(
$num
)
{
print
'<div class="tabsAction">'
;
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=purge">'
.
$langs
->
trans
(
"Purge"
)
.
'</a>'
;
print
'</div>'
;
print
'<div class="tabsAction">'
;
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=purge">'
.
$langs
->
trans
(
"Purge"
)
.
'</a>'
;
print
'</div>'
;
}
}
else
{
dol_print_error
(
$db
);
dol_print_error
(
$db
);
}
$db
->
close
();
llxFooter
(
'$Date$ - $Revision$'
);
llxFooter
(
'$Date
: 2011/07/18 23:28:30
$ - $Revision
: 1.31
$'
);
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
htdocs/core/class/events.class.php
+
37
−
2
View file @
ab1d4b33
...
...
@@ -21,7 +21,7 @@
* \file htdocs/core/class/events.class.php
* \ingroup core
* \brief File of class to manage security events.
* \version $Id$
* \version $Id
: events.class.php,v 1.7 2011/07/18 23:32:00 eldy Exp
$
* \author Laurent Destailleur
*/
...
...
@@ -52,6 +52,42 @@ class Events // extends CommonObject
var
$dateevent
;
var
$description
;
// List of all events supported by triggers
var
$eventstolog
=
array
(
array
(
'id'
=>
'USER_LOGIN'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_LOGIN_FAILED'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_LOGOUT'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_CREATE'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_MODIFY'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_NEW_PASSWORD'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_ENABLEDISABLE'
,
'test'
=>
1
),
array
(
'id'
=>
'USER_DELETE'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_CREATE'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_MODIFY'
,
'test'
=>
1
),
array
(
'id'
=>
'GROUP_DELETE'
,
'test'
=>
1
),
/* array('id'=>'ACTION_CREATE', 'test'=>$conf->societe->enabled),
array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled),
array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled),
array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_CLOSE_SIGNED', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_CLOSE_REFUSED', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_SENTBYMAIL', 'test'=>$conf->propal->enabled),
array('id'=>'ORDER_VALIDATE', 'test'=>$conf->commande->enabled),
array('id'=>'ORDER_SENTBYMAIL', 'test'=>$conf->commande->enabled),
array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_CANCEL', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled),
array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled),
array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled),
array('id'=>'MEMBER_CREATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_VALIDATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_SUBSCRIPTION', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_MODIFY', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_RESILIATE', 'test'=>$conf->adherent->enabled),
array('id'=>'MEMBER_DELETE', 'test'=>$conf->adherent->enabled),
*/
);
/**
...
...
@@ -75,7 +111,6 @@ class Events // extends CommonObject
global
$conf
,
$langs
;
// Clean parameters
$this
->
id
=
trim
(
$this
->
id
);
$this
->
description
=
trim
(
$this
->
description
);
// Check parameters
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment