Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-cost
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-cost
Commits
e377fbf5
Commit
e377fbf5
authored
Dec 07, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Changed deprecated permission procs to new versions for Malte
parent
b4d0dc4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
intranet-cost-center-procs.tcl
tcl/intranet-cost-center-procs.tcl
+41
-1
intranet-cost-procs.tcl
tcl/intranet-cost-procs.tcl
+2
-2
No files found.
tcl/intranet-cost-center-procs.tcl
View file @
e377fbf5
...
...
@@ -421,7 +421,7 @@ ad_proc -public im_cc_read_p {
{
-cost_type_id 0
}
{
-privilege
""
}
}
{
Returns
"1"
if the user can read the
global
"company"
CC
Returns
"1"
if the user can read the CC
}
{
# User can read all CCs if no Profit Center Controlling is installed
set pcenter_p
[
util_memoize
[
list
db_string pcent
"select count(*) from apm_packages where package_key = 'intranet-cost-center'"
]]
...
...
@@ -447,6 +447,46 @@ ad_proc -public im_cc_read_p {
return
[
string
equal
"t"
$true
_false
]
}
ad_proc -public im_cc_write_p
{
{
-user_id 0
}
{
-cost_center_id 0
}
{
-cost_type_id 0
}
{
-privilege
""
}
}
{
Returns
"1"
if the user can write the CC
}
{
# User can read all CCs if no Profit Center Controlling is installed
set pcenter_p
[
util_memoize
[
list
db_string pcent
"select count(*) from apm_packages where package_key = 'intranet-cost-center'"
]]
if
{
""
==
$cost
_center_id
}
{
return 1
}
if
{
!$pcenter_p
}
{
return 1
}
im_security_alert_check_integer -location
"im_cc_read_p: user_id"
-value
$user
_id
im_security_alert_check_integer -location
"im_cc_read_p: cost_type_id"
-value
$cost
_type_id
im_security_alert_check_integer -location
"im_cc_read_p: cost_center_id"
-value
$cost
_center_id
im_security_alert_check_alphanum -location
"im_cc_read_p: privilege"
-value
$privilege
# Deal with exceptions
if
{
0 ==
$user
_id
}
{
set user_id
[
ad_conn user_id
]
}
if
{
0 ==
$cost
_center_id
}
{
set cost_center_id
[
im_cost_center_company
]
}
if
{
0 !=
$cost
_type_id
}
{
set privilege
[
util_memoize
[
list
db_string priv
"
select write_privilege
from im_cost_types
where cost_type_id in (select * from im_sub_categories(
$cost
_type_id))
"
-default
""
]]
}
if
{
""
==
$privilege
}
{
set privilege
"fi_write_all"
}
set true_false
[
util_memoize
[
list
db_string company_cc_read
"select im_object_permission_p(
$cost
_center_id,
$user
_id, '
$privilege
')"
-default f
]
60
]
if
{
"t"
eq
$true
_false
}
{
return 1
}
set true_false
[
util_memoize
[
list
im_cost_center_write_p_helper
$cost
_center_id
$cost
_type_id
$user
_id
]
60
]
return
[
string
equal
"t"
$true
_false
]
}
ad_proc -public im_cost_center_write_p
{
cost_center_id
cost_type_id
...
...
tcl/intranet-cost-procs.tcl
View file @
e377fbf5
...
...
@@ -188,8 +188,8 @@ ad_proc -public im_cost_permissions {user_id cost_id view_var read_var write_var
# -----------------------------------------------------
# Cost Center permissions - check if the user has read permissions
# for this particular cost center
set cc_read
[
im_cc_read_p
$cost
_center_id
$cost
_type_id
$user
_id
]
set cc_write
[
im_cc_write_p
$cost
_center_id
$cost
_type_id
$user
_id
]
set cc_read
[
im_cc_read_p
-user_id
$user
_id -cost_center_id
$cost
_center_id -cost_type_id
$cost
_type
_id
]
set cc_write
[
im_cc_write_p
-user_id
$user
_id -cost_center_id
$cost
_center_id -cost_type_id
$cost
_type
_id
]
set can_read
[
expr
[
im_permission
$user
_id view_costs
]
||
[
im_permission
$user
_id view_invoices
]]
set can_write
[
expr
[
im_permission
$user
_id add_costs
]
||
[
im_permission
$user
_id add_invoices
]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment