Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
86d6bad9
Unverified
Commit
86d6bad9
authored
4 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(ogroup) Move GroupMembersAttribute to its own file
issue #5818
parent
018c7e5c
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/admin/groups/class_GroupMembersAttribute.inc
+70
-0
plugins/admin/groups/class_GroupMembersAttribute.inc
plugins/admin/groups/class_ogroup.inc
+0
-49
plugins/admin/groups/class_ogroup.inc
with
70 additions
and
49 deletions
+70
-49
plugins/admin/groups/class_GroupMembersAttribute.inc
0 → 100644
+
70
−
0
View file @
86d6bad9
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
Copyright (C) 2011-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
GroupMembersAttribute
extends
ObjectsAttribute
{
protected
$typeToCodeMap
;
function
__construct
(
$label
,
$description
,
$ldapName
,
$required
=
FALSE
,
$defaultValue
=
[],
$store_attr
=
'dn'
,
$display_attr
=
'cn'
,
array
$filterElementDefinitions
=
NULL
,
$acl
=
''
)
{
parent
::
__construct
(
$label
,
$description
,
$ldapName
,
$required
,
array_values
(
ogroup
::
$objectTypes
),
$defaultValue
,
$store_attr
,
$display_attr
,
$filterElementDefinitions
,
$acl
);
$this
->
typeToCodeMap
=
array_flip
(
array_map
(
'strtolower'
,
ogroup
::
$objectTypes
));
}
function
getFilterBlackList
()
{
return
[
'dn'
=>
array_merge
(
$this
->
getValue
(),
$this
->
plugin
->
used_workstations
,
[
$this
->
plugin
->
dn
])
];
}
protected
function
typeToCode
(
$type
):
string
{
if
(
$type
===
FALSE
)
{
return
'I'
;
}
else
{
return
$this
->
typeToCodeMap
[
strtolower
(
$type
)];
}
}
function
listObjectTypes
()
{
/* Refresh types and displays */
$this
->
getDisplayValues
();
return
'['
.
implode
(
''
,
array_map
([
$this
,
'typeToCode'
],
array_unique
(
$this
->
types
)))
.
']'
;
}
function
getTypedValues
()
{
$values
=
$this
->
getValue
();
$ret
=
[];
foreach
(
$values
as
$i
=>
$v
)
{
$code
=
$this
->
typeToCode
(
$this
->
types
[
$i
]);
if
(
!
isset
(
$ret
[
$code
]))
{
$ret
[
$code
]
=
[];
}
$ret
[
$code
][]
=
$v
;
}
return
$ret
;
}
}
This diff is collapsed.
Click to expand it.
plugins/admin/groups/class_ogroup.inc
+
0
−
49
View file @
86d6bad9
...
...
@@ -20,55 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
GroupMembersAttribute
extends
ObjectsAttribute
{
protected
$typeToCodeMap
;
function
__construct
(
$label
,
$description
,
$ldapName
,
$required
=
FALSE
,
$defaultValue
=
[],
$store_attr
=
'dn'
,
$display_attr
=
'cn'
,
array
$filterElementDefinitions
=
NULL
,
$acl
=
''
)
{
parent
::
__construct
(
$label
,
$description
,
$ldapName
,
$required
,
array_values
(
ogroup
::
$objectTypes
),
$defaultValue
,
$store_attr
,
$display_attr
,
$filterElementDefinitions
,
$acl
);
$this
->
typeToCodeMap
=
array_flip
(
array_map
(
'strtolower'
,
ogroup
::
$objectTypes
));
}
function
getFilterBlackList
()
{
return
[
'dn'
=>
array_merge
(
$this
->
getValue
(),
$this
->
plugin
->
used_workstations
,
[
$this
->
plugin
->
dn
])
];
}
protected
function
typeToCode
(
$type
):
string
{
if
(
$type
===
FALSE
)
{
return
'I'
;
}
else
{
return
$this
->
typeToCodeMap
[
strtolower
(
$type
)];
}
}
function
listObjectTypes
()
{
/* Refresh types and displays */
$this
->
getDisplayValues
();
return
'['
.
implode
(
''
,
array_map
([
$this
,
'typeToCode'
],
array_unique
(
$this
->
types
)))
.
']'
;
}
function
getTypedValues
()
{
$values
=
$this
->
getValue
();
$ret
=
[];
foreach
(
$values
as
$i
=>
$v
)
{
$code
=
$this
->
typeToCode
(
$this
->
types
[
$i
]);
if
(
!
isset
(
$ret
[
$code
]))
{
$ret
[
$code
]
=
[];
}
$ret
[
$code
][]
=
$v
;
}
return
$ret
;
}
}
class
ogroup
extends
simplePlugin
{
var
$used_workstations
=
[];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets