Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
803142d5
Commit
803142d5
authored
8 years ago
by
Jaime Pérez
Browse files
Options
Downloads
Patches
Plain Diff
Convert from CRLF to LF a couple of files remaining.
parent
1ebebb45
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/consentAdmin/www/includes/consentSimpleAjax.js
+70
-70
70 additions, 70 deletions
modules/consentAdmin/www/includes/consentSimpleAjax.js
tests/lib/SimpleSAML/Utils/ConfigTest.php
+55
-55
55 additions, 55 deletions
tests/lib/SimpleSAML/Utils/ConfigTest.php
with
125 additions
and
125 deletions
modules/consentAdmin/www/includes/consentSimpleAjax.js
+
70
−
70
View file @
803142d5
var
xmlHttp
;
function
checkConsent
(
consentValue
,
show_spid
,
checkAction
)
{
xmlHttp
=
GetXmlHttpObject
()
if
(
xmlHttp
==
null
)
{
alert
(
"
Browser does not support HTTP Request
"
)
return
}
var
url
=
"
consentAdmin.php
"
url
=
url
+
"
?cv=
"
+
consentValue
url
=
url
+
"
&action=
"
+
checkAction
url
=
url
+
"
&sid=
"
+
Math
.
random
()
xmlHttp
.
onreadystatechange
=
function
()
{
if
(
xmlHttp
.
readyState
==
4
||
xmlHttp
.
readyState
==
"
complete
"
)
{
setConsentText
(
xmlHttp
.
responseText
,
show_spid
);
}
}
xmlHttp
.
open
(
"
GET
"
,
url
,
true
)
xmlHttp
.
send
(
null
)
}
// This function will be automaticly called when the Ajax call is done returning data
function
stateChanged
()
{
if
(
xmlHttp
.
readyState
==
4
||
xmlHttp
.
readyState
==
"
complete
"
)
{
//Alert("Status of consent:" + xmlHttp.responseText );
}
}
// This function creates an XMLHttpRequest
function
GetXmlHttpObject
()
{
var
xmlHttp
=
null
;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
//Internet Explorer
try
{
xmlHttp
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);
}
catch
(
e
)
{
xmlHttp
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);
}
}
return
xmlHttp
;
}
function
toggleShowAttributes
(
show_spid
)
{
var
disp
=
document
.
getElementById
(
'
attributes_
'
+
show_spid
);
//var showhide = document.getElementById('showhide_' + show_spid);
var
showing
=
document
.
getElementById
(
'
showing_
'
+
show_spid
);
var
hiding
=
document
.
getElementById
(
'
hiding_
'
+
show_spid
);
disp
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
block
'
:
'
none
'
);
//showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide')
showing
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
inline
'
:
'
none
'
);
hiding
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
none
'
:
'
inline
'
);
//alert('hiding display'+hiding.display);
}
var
xmlHttp
;
function
checkConsent
(
consentValue
,
show_spid
,
checkAction
)
{
xmlHttp
=
GetXmlHttpObject
()
if
(
xmlHttp
==
null
)
{
alert
(
"
Browser does not support HTTP Request
"
)
return
}
var
url
=
"
consentAdmin.php
"
url
=
url
+
"
?cv=
"
+
consentValue
url
=
url
+
"
&action=
"
+
checkAction
url
=
url
+
"
&sid=
"
+
Math
.
random
()
xmlHttp
.
onreadystatechange
=
function
()
{
if
(
xmlHttp
.
readyState
==
4
||
xmlHttp
.
readyState
==
"
complete
"
)
{
setConsentText
(
xmlHttp
.
responseText
,
show_spid
);
}
}
xmlHttp
.
open
(
"
GET
"
,
url
,
true
)
xmlHttp
.
send
(
null
)
}
// This function will be automaticly called when the Ajax call is done returning data
function
stateChanged
()
{
if
(
xmlHttp
.
readyState
==
4
||
xmlHttp
.
readyState
==
"
complete
"
)
{
//Alert("Status of consent:" + xmlHttp.responseText );
}
}
// This function creates an XMLHttpRequest
function
GetXmlHttpObject
()
{
var
xmlHttp
=
null
;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
//Internet Explorer
try
{
xmlHttp
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);
}
catch
(
e
)
{
xmlHttp
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);
}
}
return
xmlHttp
;
}
function
toggleShowAttributes
(
show_spid
)
{
var
disp
=
document
.
getElementById
(
'
attributes_
'
+
show_spid
);
//var showhide = document.getElementById('showhide_' + show_spid);
var
showing
=
document
.
getElementById
(
'
showing_
'
+
show_spid
);
var
hiding
=
document
.
getElementById
(
'
hiding_
'
+
show_spid
);
disp
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
block
'
:
'
none
'
);
//showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide')
showing
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
inline
'
:
'
none
'
);
hiding
.
style
.
display
=
(
disp
.
style
.
display
==
'
none
'
?
'
none
'
:
'
inline
'
);
//alert('hiding display'+hiding.display);
}
This diff is collapsed.
Click to expand it.
tests/lib/SimpleSAML/Utils/ConfigTest.php
+
55
−
55
View file @
803142d5
<?php
namespace
SimpleSAML\Test\Utils
;
use
SimpleSAML\Utils\Config
;
/**
* Tests for SimpleSAML\Utils\Config
*/
class
ConfigTest
extends
\PHPUnit_Framework_TestCase
{
/**
* Test default config dir with not environment variable
*/
public
function
testDefaultConfigDir
()
{
// clear env var
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR'
);
$configDir
=
Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
dirname
(
dirname
(
dirname
(
dirname
(
__DIR__
))))
.
'/config'
);
}
/**
* Test valid dir specified by env var overrides default config dir
*/
public
function
testEnvVariableConfigDir
()
{
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
__DIR__
);
$configDir
=
Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
__DIR__
);
}
/**
* Test invalid dir specified by env var results in a thrown exception
*/
public
function
testInvalidEnvVariableConfigDirThrowsException
()
{
// I used a random hash to ensure this test directory is always invalid
$invalidDir
=
__DIR__
.
'/e9826ad19cbc4f5bf20c0913ffcd2ce6'
;
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
$invalidDir
);
$this
->
setExpectedException
(
'InvalidArgumentException'
,
'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. '
.
'Given: "'
.
$invalidDir
.
'"'
);
Config
::
getConfigDir
();
}
}
<?php
namespace
SimpleSAML\Test\Utils
;
use
SimpleSAML\Utils\Config
;
/**
* Tests for SimpleSAML\Utils\Config
*/
class
ConfigTest
extends
\PHPUnit_Framework_TestCase
{
/**
* Test default config dir with not environment variable
*/
public
function
testDefaultConfigDir
()
{
// clear env var
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR'
);
$configDir
=
Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
dirname
(
dirname
(
dirname
(
dirname
(
__DIR__
))))
.
'/config'
);
}
/**
* Test valid dir specified by env var overrides default config dir
*/
public
function
testEnvVariableConfigDir
()
{
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
__DIR__
);
$configDir
=
Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
__DIR__
);
}
/**
* Test invalid dir specified by env var results in a thrown exception
*/
public
function
testInvalidEnvVariableConfigDirThrowsException
()
{
// I used a random hash to ensure this test directory is always invalid
$invalidDir
=
__DIR__
.
'/e9826ad19cbc4f5bf20c0913ffcd2ce6'
;
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
$invalidDir
);
$this
->
setExpectedException
(
'InvalidArgumentException'
,
'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. '
.
'Given: "'
.
$invalidDir
.
'"'
);
Config
::
getConfigDir
();
}
}
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