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-plugins
Commits
ea63add5
Verified
Commit
ea63add5
authored
4 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
fix(plugins) Use new class for LDAP errors
issue
#6061
parent
afdfd343
No related merge requests found
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
dhcp/admin/dhcp/class_dhcpConfiguration.inc
+21
-3
dhcp/admin/dhcp/class_dhcpConfiguration.inc
gpg/addons/gpg/class_pgpServerInfo.inc
+7
-1
gpg/addons/gpg/class_pgpServerInfo.inc
invitations/admin/invitations/class_invitation.inc
+12
-3
invitations/admin/invitations/class_invitation.inc
mail/admin/groups/mail/class_mailGroup.inc
+8
-2
mail/admin/groups/mail/class_mailGroup.inc
mail/personal/mail/class_mailAccount.inc
+8
-2
mail/personal/mail/class_mailAccount.inc
posix/personal/posix/class_posixAccount.inc
+12
-2
posix/personal/posix/class_posixAccount.inc
renater-partage/admin/sympa/renater-partage/class_sympaAliasPartage.inc
+8
-2
...e/admin/sympa/renater-partage/class_sympaAliasPartage.inc
supann/admin/supannStructures/class_etablissement.inc
+14
-2
supann/admin/supannStructures/class_etablissement.inc
webservice/include/webservice/class_fdRPCService.inc
+5
-5
webservice/include/webservice/class_fdRPCService.inc
with
95 additions
and
22 deletions
+95
-22
dhcp/admin/dhcp/class_dhcpConfiguration.inc
+
21
−
3
View file @
ea63add5
...
...
@@ -148,7 +148,13 @@ class dhcpConfiguration extends simplePlugin
$ldap
->
rmdir_recursive
(
$dn
);
if
(
!
$ldap
->
success
())
{
$this
->
ldap_error
=
$ldap
->
get_error
();
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$dn
,
LDAP_MOD
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$dn
,
LDAP_DEL
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
}
...
...
@@ -201,13 +207,25 @@ class dhcpConfiguration extends simplePlugin
$ldap
->
modify
(
$attrs
);
if
(
!
$ldap
->
success
())
{
$this
->
ldap_error
=
$ldap
->
get_error
();
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$dn
,
LDAP_MOD
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$dn
,
LDAP_MOD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
else
{
$ldap
->
add
(
$attrs
);
if
(
!
$ldap
->
success
())
{
$this
->
ldap_error
=
$ldap
->
get_error
();
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$dn
,
LDAP_ADD
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$dn
,
LDAP_ADD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
gpg/addons/gpg/class_pgpServerInfo.inc
+
7
−
1
View file @
ea63add5
...
...
@@ -97,7 +97,13 @@ class pgpServerInfo extends simplePlugin
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
$this
->
pgpBaseKeySpaceDN
);
if
(
!
$ldap
->
success
())
{
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$this
->
pgpBaseKeySpaceDN
,
LDAP_MOD
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$this
->
pgpBaseKeySpaceDN
,
LDAP_ADD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
/* Delete the old branch if empty */
...
...
This diff is collapsed.
Click to expand it.
invitations/admin/invitations/class_invitation.inc
+
12
−
3
View file @
ea63add5
...
...
@@ -150,7 +150,10 @@ class invitation extends simplePlugin
}
$registrations
=
objects
::
count
(
'registration'
,
NULL
,
'(fdRegistrationEmailAddress='
.
ldap_escape_f
(
$email
)
.
')'
);
if
(
$registrations
>
0
)
{
$errors
[]
=
sprintf
(
_
(
'There is already a registration object for "%s"'
),
$email
);
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'There is already a registration object for "%s"'
),
$email
))
);
$failed
[]
=
$email
;
continue
;
}
...
...
@@ -169,13 +172,19 @@ class invitation extends simplePlugin
$messages
=
$tabObject
->
save
();
if
(
!
empty
(
$messages
))
{
$errors
[]
=
sprintf
(
_
(
'Failed to create registration object for "%s", because of the following errors: %s'
),
$email
,
implode
(
"
\n
"
,
$messages
));
$errors
[]
=
new
SimplePluginError
(
$this
,
nl2br
(
htmlescape
(
sprintf
(
_
(
'Failed to create registration object for "%s", because of the following errors: %s'
),
$email
,
implode
(
"
\n
"
,
$messages
))))
);
$failed
[]
=
$email
;
}
else
{
$success
++
;
}
}
else
{
$errors
[]
=
sprintf
(
_
(
'Failed to send invitation email to "%s". Check your email settings.'
),
$email
);
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Failed to send invitation email to "%s". Check your email settings.'
),
$email
))
);
$failed
[]
=
$email
;
}
}
...
...
This diff is collapsed.
Click to expand it.
mail/admin/groups/mail/class_mailGroup.inc
+
8
−
2
View file @
ea63add5
...
...
@@ -340,10 +340,16 @@ class mailGroup extends simplePlugin
if
(
!
$this
->
is_template
)
{
$this
->
mailMethod
->
connect
();
if
(
!
$this
->
mailMethod
->
is_connected
())
{
$errors
[]
=
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
else
{
if
(
!
$this
->
mailMethod
->
updateMailbox
())
{
$errors
[]
=
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
if
(
$this
->
mailMethod
->
groupAclsEnabled
())
{
$acls
=
[
...
...
This diff is collapsed.
Click to expand it.
mail/personal/mail/class_mailAccount.inc
+
8
−
2
View file @
ea63add5
...
...
@@ -367,10 +367,16 @@ class mailAccount extends simplePlugin
if
(
!
$this
->
is_template
)
{
$this
->
mailMethod
->
connect
();
if
(
!
$this
->
mailMethod
->
is_connected
())
{
$errors
[]
=
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
else
{
if
(
!
$this
->
mailMethod
->
updateMailbox
())
{
$errors
[]
=
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
if
(
!
$this
->
mailMethod
->
setQuota
(
$this
->
gosaMailQuota
))
{
msg_dialog
::
display
(
_
(
'Mail error'
),
sprintf
(
_
(
'Cannot write quota settings: %s'
),
$this
->
mailMethod
->
get_error
()),
ERROR_DIALOG
);
...
...
This diff is collapsed.
Click to expand it.
posix/personal/posix/class_posixAccount.inc
+
12
−
2
View file @
ea63add5
...
...
@@ -629,7 +629,12 @@ class posixAccount extends simplePlugin
$errors
=
array_merge
(
$errors
,
$msg
);
}
}
catch
(
FusionDirectoryException
$e
)
{
$errors
[]
=
'Exception: '
.
$e
->
getMessage
();
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
'Exception: '
.
$e
->
getMessage
()),
0
,
$e
);
}
}
}
...
...
@@ -647,7 +652,12 @@ class posixAccount extends simplePlugin
$errors
=
array_merge
(
$errors
,
$msg
);
}
}
catch
(
FusionDirectoryException
$e
)
{
$errors
[]
=
'Exception: '
.
$e
->
getMessage
();
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
'Exception: '
.
$e
->
getMessage
()),
0
,
$e
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
renater-partage/admin/sympa/renater-partage/class_sympaAliasPartage.inc
+
8
−
2
View file @
ea63add5
...
...
@@ -171,10 +171,16 @@ class sympaAliasPartage extends simplePlugin
if
(
!
$this
->
is_template
)
{
$this
->
mailMethod
->
connect
();
if
(
!
$this
->
mailMethod
->
is_connected
())
{
$errors
[]
=
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Mail method cannot connect: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
else
{
if
(
!
$this
->
mailMethod
->
updateMailbox
())
{
$errors
[]
=
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
());
$errors
[]
=
new
SimplePluginError
(
$this
,
htmlescape
(
sprintf
(
_
(
'Cannot update mailbox: %s'
),
$this
->
mailMethod
->
get_error
()))
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
supann/admin/supannStructures/class_etablissement.inc
+
14
−
2
View file @
ea63add5
...
...
@@ -198,7 +198,13 @@ class etablissement extends simplePlugin
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
modify
(
$rootAttrs
);
if
(
!
$ldap
->
success
())
{
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$config
->
current
[
'BASE'
],
0
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$config
->
current
[
'BASE'
],
LDAP_MOD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
...
...
@@ -256,7 +262,13 @@ class etablissement extends simplePlugin
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
modify
(
$rootAttrs
);
if
(
!
$ldap
->
success
())
{
$errors
[]
=
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$config
->
current
[
'BASE'
],
0
,
get_class
());
$errors
[]
=
new
SimplePluginLdapError
(
$this
,
$config
->
current
[
'BASE'
],
LDAP_MOD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
...
...
This diff is collapsed.
Click to expand it.
webservice/include/webservice/class_fdRPCService.inc
+
5
−
5
View file @
ea63add5
...
...
@@ -552,7 +552,7 @@ class fdRPCService
}
$tabobject
->
by_object
[
$tab
]
->
attributesAccess
[
$name
]
->
setValue
(
$attrvalues
);
}
else
{
throw
new
WebServiceError
(
msgPool
::
permModify
(
$dn
,
$name
),
403
);
throw
new
WebServiceError
(
htmlunescape
(
msgPool
::
permModify
(
$dn
,
$name
)
)
,
403
);
}
}
else
{
throw
new
WebServiceError
(
sprintf
(
_
(
'Unknown field "%s"'
),
$name
),
404
);
...
...
@@ -609,7 +609,7 @@ class fdRPCService
// Check permissions, are we allowed to remove this object?
$acl
=
$ui
->
get_permissions
(
$dn
,
$infos
[
'aclCategory'
]
.
'/'
.
$infos
[
'mainTab'
]);
if
(
strpos
(
$acl
,
'd'
)
===
FALSE
)
{
throw
new
WebServiceError
(
msgPool
::
permDelete
(
$dn
),
403
);
throw
new
WebServiceError
(
htmlunescape
(
msgPool
::
permDelete
(
$dn
)
)
,
403
);
}
if
(
$user
=
get_lock
(
$dn
))
{
...
...
@@ -645,7 +645,7 @@ class fdRPCService
}
}
if
(
count
(
$disallowed
))
{
throw
new
WebServiceError
(
msgPool
::
permModify
(
$disallowed
),
403
);
throw
new
WebServiceError
(
htmlunescape
(
msgPool
::
permModify
(
$disallowed
)
)
,
403
);
}
// Try to lock/unlock the entries.
...
...
@@ -714,7 +714,7 @@ class fdRPCService
}
}
if
(
count
(
$disallowed
))
{
throw
new
WebServiceError
(
msgPool
::
permView
(
$disallowed
),
403
);
throw
new
WebServiceError
(
htmlunescape
(
msgPool
::
permView
(
$disallowed
)
)
,
403
);
}
// Try to lock/unlock the entries.
...
...
@@ -765,7 +765,7 @@ class fdRPCService
if
(
$dn
!==
FALSE
)
{
/* No errors */
if
(
strpos
(
$ui
->
get_permissions
(
$dn
,
'user/user'
,
'userPassword'
),
'w'
)
===
FALSE
)
{
throw
new
WebServiceError
(
msgPool
::
permModify
(
$dn
),
403
);
throw
new
WebServiceError
(
htmlunescape
(
msgPool
::
permModify
(
$dn
)
)
,
403
);
}
$token
=
$pwRecovery
->
generateAndStoreToken
();
if
(
$token
!==
FALSE
)
{
...
...
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