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
3a2f44ad
Commit
3a2f44ad
authored
8 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix security permissions to edit/delete time spent
parent
380b61a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/projet/tasks/time.php
+20
-13
20 additions, 13 deletions
htdocs/projet/tasks/time.php
with
20 additions
and
13 deletions
htdocs/projet/tasks/time.php
+
20
−
13
View file @
3a2f44ad
...
...
@@ -128,7 +128,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
}
}
if
(
$action
==
'updateline'
&&
!
$_POST
[
"cancel"
]
&&
$user
->
rights
->
projet
->
creer
)
if
(
$action
==
'updateline'
&&
!
$_POST
[
"cancel"
]
&&
$user
->
rights
->
projet
->
lire
)
{
$error
=
0
;
...
...
@@ -141,7 +141,8 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree
if
(
!
$error
)
{
$object
->
fetch
(
$id
,
$ref
);
// TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$object
->
timespent_id
=
$_POST
[
"lineid"
];
$object
->
timespent_note
=
$_POST
[
"timespent_note_line"
];
$object
->
timespent_old_duration
=
$_POST
[
"old_duration"
];
...
...
@@ -175,9 +176,10 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree
}
}
if
(
$action
==
'confirm_delete'
&&
$confirm
==
"yes"
&&
$user
->
rights
->
projet
->
creer
)
if
(
$action
==
'confirm_delete'
&&
$confirm
==
"yes"
&&
$user
->
rights
->
projet
->
lire
)
{
$object
->
fetchTimeSpent
(
$_GET
[
'lineid'
]);
// TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$result
=
$object
->
delTimeSpent
(
$user
);
if
(
$result
<
0
)
...
...
@@ -585,6 +587,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$tasktmp
=
new
Task
(
$db
);
$childids
=
$user
->
getAllChildIds
();
$total
=
0
;
$totalvalue
=
0
;
foreach
(
$tasks
as
$task_time
)
...
...
@@ -688,17 +692,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print
'<br>'
;
print
'<input type="submit" class="button" name="cancel" value="'
.
$langs
->
trans
(
'Cancel'
)
.
'">'
;
}
else
if
(
$user
->
rights
->
projet
->
creer
)
else
if
(
$user
->
rights
->
projet
->
lire
)
// Read project and enter time consumed on assigned tasks
{
print
' '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?'
.
(
$projectidforalltimes
?
'projectid='
.
$projectidforalltimes
.
'&'
:
''
)
.
'id='
.
$task_time
->
fk_task
.
'&action=editline&lineid='
.
$task_time
->
rowid
.
(
$withproject
?
'&withproject=1'
:
''
)
.
'">'
;
print
img_edit
();
print
'</a>'
;
print
' '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?'
.
(
$projectidforalltimes
?
'projectid='
.
$projectidforalltimes
.
'&'
:
''
)
.
'id='
.
$task_time
->
fk_task
.
'&action=deleteline&lineid='
.
$task_time
->
rowid
.
(
$withproject
?
'&withproject=1'
:
''
)
.
'">'
;
print
img_delete
();
print
'</a>'
;
if
(
$task_time
->
fk_user
==
$user
->
id
||
in_array
(
$task_time
->
fk_user
,
$childids
))
{
print
' '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?'
.
(
$projectidforalltimes
?
'projectid='
.
$projectidforalltimes
.
'&'
:
''
)
.
'id='
.
$task_time
->
fk_task
.
'&action=editline&lineid='
.
$task_time
->
rowid
.
(
$withproject
?
'&withproject=1'
:
''
)
.
'">'
;
print
img_edit
();
print
'</a>'
;
print
' '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?'
.
(
$projectidforalltimes
?
'projectid='
.
$projectidforalltimes
.
'&'
:
''
)
.
'id='
.
$task_time
->
fk_task
.
'&action=deleteline&lineid='
.
$task_time
->
rowid
.
(
$withproject
?
'&withproject=1'
:
''
)
.
'">'
;
print
img_delete
();
print
'</a>'
;
}
}
print
'</td>'
;
...
...
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