mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Fix bug regarding non admin users who have an email on a given domain name (field in Admin panel settings) and that can't invite new users for a registration
This commit is contained in:
parent
01cd1c0fdc
commit
2f69501c14
1 changed files with 15 additions and 1 deletions
|
@ -274,6 +274,20 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isNonAdminAllowedToSendMail(currentUser){
|
||||||
|
const currSett = Settings.findOne({});
|
||||||
|
let isAllowed = false;
|
||||||
|
if(currSett && currSett != undefined && currSett.disableRegistration && currSett.mailDomainName !== undefined && currSett.mailDomainName != ""){
|
||||||
|
for(let i = 0; i < currentUser.emails.length; i++) {
|
||||||
|
if(currentUser.emails[i].address.endsWith(currSett.mailDomainName)){
|
||||||
|
isAllowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
function isLdapEnabled() {
|
function isLdapEnabled() {
|
||||||
return (
|
return (
|
||||||
process.env.LDAP_ENABLE === 'true' || process.env.LDAP_ENABLE === true
|
process.env.LDAP_ENABLE === 'true' || process.env.LDAP_ENABLE === true
|
||||||
|
@ -304,7 +318,7 @@ if (Meteor.isServer) {
|
||||||
check(boards, [String]);
|
check(boards, [String]);
|
||||||
|
|
||||||
const user = Users.findOne(Meteor.userId());
|
const user = Users.findOne(Meteor.userId());
|
||||||
if (!user.isAdmin) {
|
if (!user.isAdmin && !isNonAdminAllowedToSendMail(user)) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
throw new Meteor.Error('not-allowed');
|
throw new Meteor.Error('not-allowed');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue