Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
ldap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lib
unicaen
ldap
Commits
f5e8085d
Commit
f5e8085d
authored
Jun 26, 2020
by
David Surville
Browse files
Options
Downloads
Patches
Plain Diff
[Evolution] Développement UnicaenLdap WIP
parent
8d66ec30
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/UnicaenLdap/Entity/Base/People.php
+31
-12
31 additions, 12 deletions
src/UnicaenLdap/Entity/Base/People.php
src/UnicaenLdap/Entity/People.php
+158
-10
158 additions, 10 deletions
src/UnicaenLdap/Entity/People.php
with
189 additions
and
22 deletions
src/UnicaenLdap/Entity/Base/People.php
+
31
−
12
View file @
f5e8085d
...
...
@@ -18,6 +18,25 @@ use Zend\Ldap\Exception\LdapException;
*/
class
People
extends
Entity
{
/**
* Constantes pour les champs eduPersonAffiliation et eduPersonPrimaryAffiliation
*/
const
STATUS_AFFILIATE
=
'affiliate'
;
const
STATUS_ALUM
=
'alum'
;
const
STATUS_EMERITUS
=
'emeritus'
;
const
STATUS_EMPLOYEE
=
'employee'
;
const
STATUS_FACULTY
=
'faculty'
;
const
STATUS_MEMBER
=
'member'
;
const
STATUS_REGISTERED_READER
=
'registered-reader'
;
const
STATUS_RESEARCHER
=
'researcher'
;
const
STATUS_RETIRED
=
'retired'
;
const
STATUS_STAFF
=
'staff'
;
const
STATUS_STUDENT
=
'student'
;
const
STATUS_TEACHER
=
'teacher'
;
/**
* @var string
*/
protected
$type
=
'People'
;
/**
...
...
@@ -208,18 +227,18 @@ class People extends Entity
* @var array
*/
protected
$eduPersonAffiliationAuthorizedValues
=
[
'affiliate'
,
'alum'
,
'emeritus'
,
'employee'
,
'faculty'
,
'member'
,
'registered-reader'
,
'researcher'
,
'retired'
,
'staff'
,
'student'
,
'teacher'
,
self
::
STATUS_AFFILIATE
,
self
::
STATUS_ALUM
,
self
::
STATUS_EMERITUS
,
self
::
STATUS_EMPLOYEE
,
self
::
STATUS_FACULTY
,
self
::
STATUS_MEMBER
,
self
::
STATUS_REGISTERED_READER
,
self
::
STATUS_RESEARCHER
,
self
::
STATUS_RETIRED
,
self
::
STATUS_STAFF
,
self
::
STATUS_STUDENT
,
self
::
STATUS_TEACHER
,
];
/**
...
...
This diff is collapsed.
Click to expand it.
src/UnicaenLdap/Entity/People.php
+
158
−
10
View file @
f5e8085d
...
...
@@ -70,27 +70,175 @@ class People extends BasePeople
}
/**
* Retourne le nom complet
de cet individu LDAP
.
* Retourne le nom complet.
*
* @param boolean $
nomEnMajuscule Mettre l
e nom de famille en majuscules
?
* @param boolean $
avec
Civilit
e I
nclure la civilité
?
* @param boolean $
prenomDabord Mettre le
prénom avant le nom de famille
?
* @param boolean $
uppercaseNam
e nom de famille en majuscules
* @param boolean $
with
Civilit
y i
nclure la civilité
* @param boolean $
firstNameFirst
prénom avant le nom de famille
* @return string
*/
public
function
get
NomComplet
(
$nomEnMajuscul
e
=
false
,
$
avec
Civilit
e
=
false
,
$
prenomDabord
=
false
)
public
function
get
FullName
(
$uppercaseNam
e
=
false
,
$
with
Civilit
y
=
false
,
$
firstNameFirst
=
false
)
{
$sn
=
$this
->
get
(
'sn'
)
;
$sn
=
$this
->
sn
;
$sn
=
is_array
(
$sn
)
?
current
(
$sn
)
:
$sn
;
if
(
!
$sn
)
{
return
''
;
}
$nom
=
$
nomEnMajuscul
e
?
strtoupper
(
$sn
)
:
$sn
;
$prenom
=
$this
->
get
(
'
given
n
ame
'
)
;
$civilite
=
$
avec
Civilit
e
?
' '
.
$this
->
get
(
'
supannCivilite
'
)
:
null
;
$nom
=
$
uppercaseNam
e
?
mb_
strtoupper
(
$sn
,
'UTF-8'
)
:
$sn
;
$prenom
=
$this
->
given
N
ame
;
$civilite
=
$
with
Civilit
y
?
$this
->
supannCivilite
.
' '
:
''
;
return
(
$prenomDabord
?
$prenom
.
' '
.
$nom
:
$nom
.
' '
.
$prenom
)
.
$civilite
;
return
$civilite
.
(
$firstNameFirst
?
$prenom
.
' '
.
$nom
:
$nom
.
' '
.
$prenom
);
}
/**
* Retourne la date de naissance
*
* @return DateTime|false
*/
public
function
getDateOfBirth
()
{
return
DateTime
::
createFromFormat
(
'Ymd h:i:s'
,
$this
->
schacDateOfBirth
.
' 00:00:00'
);
}
/**
* Retourne la date d'expiration
*
* @return DateTime|false
*/
public
function
getExpiryDate
()
{
return
DateTime
::
createFromFormat
(
'Ymd h:i:s'
,
$this
->
schacExpiryDate
.
' 00:00:00'
);
}
/**
* @param string $status
* @return bool
*/
protected
function
whichStatus
(
string
$status
):
bool
{
return
in_array
(
$status
,
(
array
)
$this
->
eduPersonAffiliation
);
}
/**
* Check "affiliate" status
*
* @return bool
*/
public
function
isAffiliate
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_AFFILIATE
);
}
/**
* Check "alum" status
*
* @return bool
*/
public
function
isAlum
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_ALUM
);
}
/**
* Check "emeritus" status
*
* @return bool
*/
public
function
isEmeritus
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_EMERITUS
);
}
/**
* Check "employee" status
*
* @return bool
*/
public
function
isEmployee
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_EMPLOYEE
);
}
/**
* Check "faculty" status
*
* @return bool
*/
public
function
isFaculty
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_FACULTY
);
}
/**
* Check "member" status
*
* @return bool
*/
public
function
isMember
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_MEMBER
);
}
/**
* Check "registered reader" status
*
* @return bool
*/
public
function
isRegisteredReader
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_REGISTERED_READER
);
}
/**
* Check "researcher" status
*
* @return bool
*/
public
function
isResearcher
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_RESEARCHER
);
}
/**
* Check "retired" status
*
* @return bool
*/
public
function
isRetired
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_RETIRED
);
}
/**
* Check "staff" status
*
* @return bool
*/
public
function
isStaff
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_STAFF
);
}
/**
* Check "student" status
*
* @return bool
*/
public
function
isStudent
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_STUDENT
);
}
/**
* Check "teacher" status
*
* @return bool
*/
public
function
isTeacher
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_TEACHER
);
}
/**
...
...
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