When user logins, "Automatically add user with the domain name" (at Admin Panel / Organizations) to Organization. Part 1.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2023-11-19 23:33:40 +02:00
parent f512047ac6
commit 6e2f84673e
4 changed files with 48 additions and 0 deletions

View file

@ -78,6 +78,7 @@ template(name="orgGeneral")
th {{_ 'displayName'}}
th {{_ 'description'}}
th {{_ 'shortName'}}
th {{_ 'autoAddUsersWithDomainName'}}
th {{_ 'website'}}
th {{_ 'createdAt'}}
th {{_ 'active'}}
@ -159,6 +160,10 @@ template(name="orgRow")
td {{ orgData.orgShortName }}
else
td <s>{{ orgData.orgShortName }}</s>
if orgData.orgIsActive
td {{ orgData.orgAutoAddUsersWithDomainName }}
else
td <s>{{ orgData.orgAutoAddUsersWithDomainName }}</s>
if orgData.orgIsActive
td {{ orgData.orgWebsite }}
else
@ -307,6 +312,9 @@ template(name="editOrgPopup")
label
| {{_ 'shortName'}}
input.js-orgShortName(type="text" value=org.orgShortName required)
label
| {{_ 'autoAddUsersWithDomainName'}}
input.js-orgAutoAddUsersWithDomainName(type="text" value=org.orgAutoAddUsersWithDomainName)
label
| {{_ 'website'}}
input.js-orgWebsite(type="text" value=org.orgWebsite required)
@ -436,6 +444,9 @@ template(name="newOrgPopup")
label
| {{_ 'shortName'}}
input.js-orgShortName(type="text" value="" required)
label
| {{_ 'autoAddUsersWithDomainName'}}
input.js-orgAutoAddUsersWithDomainName(type="text" value="")
label
| {{_ 'website'}}
input.js-orgWebsite(type="text" value="" required)

View file

@ -576,12 +576,14 @@ Template.editOrgPopup.events({
.value.trim();
const orgDesc = templateInstance.find('.js-orgDesc').value.trim();
const orgShortName = templateInstance.find('.js-orgShortName').value.trim();
const orgAutoAddUsersWithDomainName = templateInstance.find('.js-orgAutoAddUsersWithDomainName').value.trim();
const orgWebsite = templateInstance.find('.js-orgWebsite').value.trim();
const orgIsActive = templateInstance.find('.js-org-isactive').value.trim() == 'true';
const isChangeOrgDisplayName = orgDisplayName !== org.orgDisplayName;
const isChangeOrgDesc = orgDesc !== org.orgDesc;
const isChangeOrgShortName = orgShortName !== org.orgShortName;
const isChangeOrgAutoAddUsersWithDomainName = orgAutoAddUsersWithDomainName !== org.orgAutoAddUsersWithDomainName;
const isChangeOrgWebsite = orgWebsite !== org.orgWebsite;
const isChangeOrgIsActive = orgIsActive !== org.orgIsActive;
@ -589,6 +591,7 @@ Template.editOrgPopup.events({
isChangeOrgDisplayName ||
isChangeOrgDesc ||
isChangeOrgShortName ||
isChangeOrgAutoAddUsersWithDomainName ||
isChangeOrgWebsite ||
isChangeOrgIsActive
) {
@ -598,6 +601,7 @@ Template.editOrgPopup.events({
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
);
@ -920,6 +924,7 @@ Template.newOrgPopup.events({
.value.trim();
const orgDesc = templateInstance.find('.js-orgDesc').value.trim();
const orgShortName = templateInstance.find('.js-orgShortName').value.trim();
const orgAutoAddUsersWithDomainName = templateInstance.find('.js-orgAutoAddUsersWithDomainName').value.trim();
const orgWebsite = templateInstance.find('.js-orgWebsite').value.trim();
const orgIsActive =
templateInstance.find('.js-org-isactive').value.trim() == 'true';
@ -929,6 +934,7 @@ Template.newOrgPopup.events({
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
);

View file

@ -962,6 +962,7 @@
"teams": "Teams",
"displayName": "Display Name",
"shortName": "Short Name",
"autoAddUsersWithDomainName": "Automatically add users with the domain name",
"website": "Website",
"person": "Person",
"my-cards": "My Cards",

View file

@ -30,6 +30,14 @@ Org.attachSchema(
optional: true,
max: 255,
},
orgAutoAddUsersWithDomainName: {
/**
* automatically add users with domain name
*/
type: String,
optional: true,
max: 255,
},
orgWebsite: {
/**
* website of the organization
@ -115,6 +123,7 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
) {
@ -122,6 +131,7 @@ if (Meteor.isServer) {
check(orgDisplayName, String);
check(orgDesc, String);
check(orgShortName, String);
check(orgAutoAddUsersWithDomainName, String);
check(orgWebsite, String);
check(orgIsActive, Boolean);
@ -133,6 +143,7 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
});
@ -143,12 +154,14 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
) {
check(orgDisplayName, String);
check(orgDesc, String);
check(orgShortName, String);
check(orgAutoAddUsersWithDomainName, String);
check(orgWebsite, String);
check(orgIsActive, Boolean);
@ -160,6 +173,7 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
});
@ -196,6 +210,16 @@ if (Meteor.isServer) {
}
},
setAutoAddUsersWithDomainName(org, orgAutoAddUsersWithDomainName) {
if (ReactiveCache.getCurrentUser()?.isAdmin) {
check(org, Object);
check(orgAutoAddUsersWithDomainName, String);
Org.update(org, {
$set: { orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName },
});
}
},
setOrgIsActive(org, orgIsActive) {
if (ReactiveCache.getCurrentUser()?.isAdmin) {
check(org, Object);
@ -210,6 +234,7 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
) {
@ -217,6 +242,7 @@ if (Meteor.isServer) {
check(orgDisplayName, String);
check(orgDesc, String);
check(orgShortName, String);
check(orgAutoAddUsersWithDomainName, String);
check(orgWebsite, String);
check(orgIsActive, Boolean);
Org.update(org, {
@ -224,6 +250,7 @@ if (Meteor.isServer) {
orgDisplayName: orgDisplayName,
orgDesc: orgDesc,
orgShortName: orgShortName,
orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName,
orgWebsite: orgWebsite,
orgIsActive: orgIsActive,
},
@ -235,6 +262,7 @@ if (Meteor.isServer) {
orgDisplayName,
orgDesc,
orgShortName,
orgAutoAddUsersWithDomainName,
orgWebsite,
orgIsActive,
) {
@ -243,6 +271,7 @@ if (Meteor.isServer) {
check(orgDisplayName, String);
check(orgDesc, String);
check(orgShortName, String);
check(orgAutoAddUsersWithDomainName, String);
check(orgWebsite, String);
check(orgIsActive, Boolean);
Org.update(org, {
@ -250,6 +279,7 @@ if (Meteor.isServer) {
orgDisplayName: orgDisplayName,
orgDesc: orgDesc,
orgShortName: orgShortName,
orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName,
orgWebsite: orgWebsite,
orgIsActive: orgIsActive,
},