Commit da79e8cf authored by Frank Bergmann's avatar Frank Bergmann

- Gustaf changes

parent f7099570
......@@ -60,8 +60,8 @@ ad_proc -private im_rest_get_object_type {
# -------------------------------------------------------
# Get some more information about the current object type
set otype_info [util_memoize [list db_list_of_lists rest_otype_info "select table_name, id_column from acs_object_types where object_type = '$rest_otype'"]]
set table_name [lindex [lindex $otype_info 0] 0]
set id_column [lindex [lindex $otype_info 0] 1]
set table_name [lindex $otype_info 0 0]
set id_column [lindex $otype_info 0 1]
if {"" == $table_name} {
im_rest_error -format $org_format -http_status 500 -message "Invalid DynField configuration: Object type '$rest_otype' doesn't have a table_name specified in table acs_object_types."
}
......@@ -840,7 +840,7 @@ ad_proc -private im_rest_get_im_categories {
set category_translated [lang::message::lookup $locale $category_key $category]
# Calculate indent
set indent [expr [string length tree_sortkey] - 8]
set indent [expr {[string length tree_sortkey] - 8}]
# Check permissions
set read_p $rest_otype_read_all_p
......
......@@ -261,10 +261,10 @@ ad_proc -private im_rest_call_get {
# Security checks
set alert_p 0
set alert_p [expr $alert_p || [im_security_alert_check_integer -location "im_rest_call: user_id" -value $auth_user_id]]
set alert_p [expr {$alert_p || [im_security_alert_check_integer -location "im_rest_call: user_id" -value $auth_user_id]}]
if {"data-source" != $rest_otype} {
set alert_p [expr $alert_p || [im_security_alert_check_integer -location "im_rest_call: rest_oid" -value $rest_oid]]
set alert_p [expr $alert_p || [im_security_alert_check_alphanum -location "im_rest_call: rest_otype" -value $rest_otype]]
set alert_p [expr {$alert_p || [im_security_alert_check_integer -location "im_rest_call: rest_oid" -value $rest_oid]}]
set alert_p [expr {$alert_p || [im_security_alert_check_alphanum -location "im_rest_call: rest_otype" -value $rest_otype]}]
}
if {$alert_p} {
return [im_rest_error -format $format -http_status 500 -message "Internal error: Found a security error, please check your security notifications"]
......
......@@ -531,7 +531,7 @@ ad_proc -public sql_value_litteral {str} {
set str [string range $str 1 end]
set char [string range $str 0 0]
set cnt 0
while {$cnt < 1000 && "'" != $char && [string length $str] > 0} {
while {$cnt < 1000 && "'" != $char && $str ne ""} {
append lit $char
set str [string range $str 1 end]
set char [string range $str 0 0]
......@@ -544,7 +544,7 @@ ad_proc -public sql_value_litteral {str} {
# Skip whitespaces after tick
set cnt 0
set char [string range $str 0 0]
while {$cnt < 1000 && " " == $char && [string length $str] > 0} {
while {$cnt < 1000 && " " == $char && $str ne ""} {
set str [string range $str 1 end]
set char [string range $str 0 0]
incr cnt
......@@ -618,7 +618,7 @@ ad_proc -public sql_operator {str} {
# ns_log Notice "sql_operator: $str"
set s0 [lindex $str 0]
set operators {"=" "!=" "<" ">" "<=" ">=" "<>"}
set operators {"=" " != " "<" ">" "<=" ">=" "<>"}
set found_operator ""
foreach operator $operators {
if {$s0 == $operator} { return [list $operator [lrange $str 1 end] ""] }
......
......@@ -269,7 +269,7 @@ ad_proc -public im_rest_object_type_select_sql {
set super_types [im_object_super_types -object_type $rest_otype]
set s [list]
foreach t $super_types {
if {$t == "acs_object"} { continue }
if {$t eq "acs_object"} { continue }
lappend s $t
}
set super_types $s
......@@ -643,8 +643,8 @@ ad_proc -public im_rest_get_content {} {
# ns_openexcl can fail, since tmpnam is known not to
# be thread/process safe. Hence spin till success
set fp ""
while {$fp == ""} {
set filename "[ns_tmpnam][clock clicks -milliseconds].rpc2"
while {$fp eq ""} {
set filename "[ad_tmpnam][clock clicks -milliseconds].rpc2"
set fp [ns_openexcl $filename]
}
......
......@@ -43,7 +43,7 @@ ad_proc -private im_rest_validate_call {
foreach {rfd wfd headers} $connInfo break
close $wfd
set length [ns_set iget $headers content-length]
if {[string match "" $length]} {
if {$length eq ""} {
set length -1
}
set page ""
......@@ -52,7 +52,7 @@ ad_proc -private im_rest_validate_call {
while {1} {
set buf [_ns_http_read $timeout $rfd $length]
append page $buf
if {[string match "" $buf]} {
if {$buf eq ""} {
break
}
if {$length > 0} {
......@@ -196,7 +196,7 @@ ad_proc -private im_rest_validate_list {
if {[info exists result_hash(total)]} { set total $result_hash(total) }
if {[info exists result_hash(success)]} { set success $result_hash(success) }
if {[info exists result_hash(message)]} { set message $result_hash(message) }
if {[info exists result_hash(data)]} { set data [lindex [lindex [lindex $result_hash(data) 1] 0] 1] }
if {[info exists result_hash(data)]} { set data [lindex [lindex $result_hash(data) 1] 0 1] }
set data_len [llength $data]
set link "<a href=$url>url</a>"
......@@ -257,7 +257,7 @@ ad_proc -private im_rest_validate_projects {
if {[info exists result_hash(total)]} { set total $result_hash(total) }
if {[info exists result_hash(success)]} { set success $result_hash(success) }
if {[info exists result_hash(message)]} { set message $result_hash(message) }
if {[info exists result_hash(data)]} { set data [lindex [lindex [lindex $result_hash(data) 1] 0] 1] }
if {[info exists result_hash(data)]} { set data [lindex [lindex $result_hash(data) 1] 0 1] }
set data_len [llength $data]
set link "<a href=$url>url</a>"
}
......@@ -340,7 +340,7 @@ ad_proc -private im_rest_validate_projects {
if {[info exists result_hash(total)]} { set total $result_hash(total) }
if {[info exists result_hash(success)]} { set success $result_hash(success) }
if {[info exists result_hash(message)]} { set message $result_hash(message) }
if {[info exists result_hash(data)]} { set data [lindex [lindex [lindex $result_hash(data) 1] 0] 1] }
if {[info exists result_hash(data)]} { set data [lindex [lindex $result_hash(data) 1] 0 1] }
set data_len [llength $data]
set link "<a href=$url>url</a>"
......@@ -368,7 +368,7 @@ ad_proc -private im_rest_validate_projects {
if {[info exists result_hash(total)]} { set total $result_hash(total) }
if {[info exists result_hash(success)]} { set success $result_hash(success) }
if {[info exists result_hash(message)]} { set message $result_hash(message) }
if {[info exists result_hash(data)]} { set data [lindex [lindex [lindex $result_hash(data) 1] 0] 1] }
if {[info exists result_hash(data)]} { set data [lindex [lindex $result_hash(data) 1] 0 1] }
set link "<a href=$url>url</a>"
set color "white"
......@@ -384,7 +384,7 @@ ad_proc -private im_rest_validate_projects {
set operation "update"
set form_vars [export_vars {auth_token {user_id $rest_user_id} {format json}}]
set prob [expr round(rand() * 100.0 * 10000.0) / 10000.0]
set prob [expr {round(rand() * 100.0 * 10000.0) / 10000.0}]
set form [ns_set new]
ns_set put $form presales_probability $prob
......@@ -406,7 +406,7 @@ ad_proc -private im_rest_validate_projects {
if {[info exists result_hash(total)]} { set total $result_hash(total) }
if {[info exists result_hash(success)]} { set success $result_hash(success) }
if {[info exists result_hash(message)]} { set message $result_hash(message) }
if {[info exists result_hash(data)]} { set data [lindex [lindex [lindex $result_hash(data) 1] 0] 1] }
if {[info exists result_hash(data)]} { set data [lindex [lindex $result_hash(data) 1] 0 1] }
set link "<a href=$url>url</a>"
set color "white"
......
......@@ -14,7 +14,7 @@ ad_page_contract {
# --------------------------------------------
# Security & Permissions
#
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
if {"" == $cost_center_id || 0 == $cost_center_id} {
# Use the topmost cost center as the base
set cost_center_id [im_cost_center_company]
......
......@@ -18,7 +18,7 @@ set debug_p 0
# ---------------------------------------------------------------
# Check that the user is logged in
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
ns_log Notice "project-task-tree-action: query_hash_pairs=$query_hash_pairs"
array set var_hash $query_hash_pairs
set action $var_hash(action)
......
......@@ -17,7 +17,7 @@ ns_log Notice "project-task-tree.json: query_hash_pairs=$query_hash_pairs"
# --------------------------------------------
# Security & Permissions
#
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
im_project_permissions $current_user_id $project_id view read write admin
if {!$read} {
im_rest_error -format "json" -http_status 403 -message "You (user #$current_user_id) have no permissions to read project #$project_id"
......
......@@ -2,8 +2,8 @@
<else>
<master>
<property name="title">@page_title@</property>
<property name="context">@context_bar@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="context">@context_bar;literal@</property>
@html;noquote@
......
......@@ -2,8 +2,8 @@
<else>
<master>
<property name="title">@page_title@</property>
<property name="context">@context_bar@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="context">@context_bar;literal@</property>
<h1>@page_title@</h1>
<p>Please see the <a href="http://www.project-open.com/en/package-intranet-rest"
......
......@@ -158,7 +158,7 @@ switch $format {
# ---------------------------------------------------------
set json_p 0
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
set current_user_is_admin_p [im_is_user_site_wide_or_intranet_admin $current_user_id]
set page_title [lang::message::lookup "" intranet-rest.REST_API "REST API"]
set context_bar [im_context_bar $page_title]
......
......@@ -2,8 +2,8 @@
<else>
<master>
<property name="title">@page_title@</property>
<property name="context">@context_bar@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="context">@context_bar;literal@</property>
<h1>@page_title@</h1>
<p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment