Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PlanetRed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Digital Experience Group
PlanetRed
Commits
d06a6945
Commit
d06a6945
authored
15 years ago
by
Eric Rasmussen
Browse files
Options
Downloads
Patches
Plain Diff
pre-populate current location
parent
b39d04c2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cas_auth/start.php
+76
-4
76 additions, 4 deletions
cas_auth/start.php
with
76 additions
and
4 deletions
cas_auth/start.php
+
76
−
4
View file @
d06a6945
...
...
@@ -42,7 +42,57 @@
public
$unlSISPermState
;
public
$unlSISPermZip
;
public
$unlSISMajor
;
public
$unlEmailAlias
;
public
$unlEmailAlias
;
/**
* Takes in a string from the LDAP directory, usually formatted like:
* ### ___ UNL 68588-####
* Where ### is the room number, ___ = Building Abbreviation, #### zip extension
*
* @param string
* @return array Associative array.
*/
function
formatPostalAddress
()
{
/* this is a faculty postal address
Currently of the form:
### ___ UNL 68588-####
Where ### is the room number, ___ = Building Abbreviation, #### zip extension
*/
/**
* We assumed that the address format is: ### ___ UNL 68588-####.
* Some 'fortunate' people have addresses not in this format.
*/
//RLIM
// treat UNL as the delimiter for the streetaddress and zip
if
(
strpos
(
$this
->
postalAddress
,
'UNL'
))
{
$addressComponent
=
explode
(
'UNL'
,
$this
->
postalAddress
);
}
elseif
(
strpos
(
$this
->
postalAddress
,
'UNO'
))
{
$addressComponent
=
explode
(
'UNO'
,
$this
->
postalAddress
);
}
elseif
(
strpos
(
$this
->
postalAddress
,
'Omaha'
))
{
$addressComponent
=
explode
(
'Omaha'
,
$this
->
postalAddress
);
}
else
{
$addressComponent
=
array
(
$this
->
postalAddress
);
}
$address
[
'region'
]
=
'NE'
;
$address
[
'street-address'
]
=
trim
(
$addressComponent
[
0
]);
if
(
isset
(
$addressComponent
[
1
]))
{
$address
[
'postal-code'
]
=
trim
(
$addressComponent
[
1
]);
}
else
{
$address
[
'postal-code'
]
=
''
;
}
switch
(
substr
(
$address
[
'postal-code'
],
0
,
3
))
{
case
'681'
:
$address
[
'locality'
]
=
'Omaha'
;
break
;
case
'685'
:
default
:
$address
[
'locality'
]
=
'Lincoln'
;
break
;
}
return
$address
;
}
}
...
...
@@ -78,6 +128,7 @@
$cas_user
=
getUserCas
();
if
(
ldapAuthenticate
(
$cas_user
))
{
system_message
(
elgg_echo
(
'loginok'
));
$cas_user
=
str_replace
(
'-'
,
'_'
,
$cas_user
);
forward
(
"pg/profile/unl_"
.
$cas_user
);
}
else
register_error
(
elgg_echo
(
'loginerror'
));
...
...
@@ -285,7 +336,9 @@
{
*/
$pf_user_info
=
peoplefinderServices
(
$username
);
// we're making this copy for use in the peoplefinderservices call later
// we dont want to call peoplefinderservices here since we dont need to every time a SSO user logs in
$casusername
=
$username
;
//We're going to make every UNL SSO user have an elgg profile name as such: unl_erasmussen2
//and not allow friends of unl who register via elgg to pick names that begin with "unl_"
...
...
@@ -305,6 +358,8 @@
else
{
// Valid login but user doesn't exist
$pf_user_info
=
peoplefinderServices
(
$casusername
);
//if ($user_create)
//{
// $name = $ldap_user_info['firstname'];
...
...
@@ -347,9 +402,26 @@
try
{
if
(
$user_guid
=
register_user
(
$username
,
'generic'
,
$name
,
$email
,
false
,
0
,
''
,
true
))
{
$thisuser
=
get_user
(
$user_guid
);
// Success, credentials valid and account has been created
return
login
(
get_user
(
$user_guid
));
//pre-populate profile fields with data from Peoplefinder Services
$address
=
$pf_user_info
->
formatPostalAddress
();
$thisuser
->
profile_country
=
'USA'
;
$thisuser
->
profile_state
=
$address
[
'region'
];
$thisuser
->
profile_city
=
$address
[
'locality'
];
if
(
$address
[
'locality'
]
==
'Omaha'
)
{
$thisuser
->
longitude
=
-
95.9
;
$thisuser
->
latitude
=
41.25
;
}
else
{
//this is going to cover Lincoln and everyone else
$thisuser
->
longitude
=
-
96.7
;
$thisuser
->
latitude
=
40.82
;
}
// Success, credentials valid and account has been created
$_SESSION
[
'last_forward_from'
]
=
$CONFIG
->
url
.
'mod/profile/edit.php?firstlogin=yes'
;
return
login
(
$thisuser
);
}
else
{
register_error
(
elgg_echo
(
"registerbad"
));
}
...
...
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