mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 16:40:30 +00:00
requested changes
This commit is contained in:
@@ -105,6 +105,7 @@ export const getMicrosoftTeamsAccessToken = async (
|
||||
}
|
||||
|
||||
if (getBotFrameworkToken) {
|
||||
// If the token expires within the next 5 minutes, we'll get a new token instead of using the stored one.
|
||||
const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000);
|
||||
|
||||
if (
|
||||
@@ -124,6 +125,7 @@ export const getMicrosoftTeamsAccessToken = async (
|
||||
return botAccessToken.toString();
|
||||
}
|
||||
} else {
|
||||
// If the token expires within the next 5 minutes, we'll get a new token instead of using the stored one.
|
||||
const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000);
|
||||
|
||||
if (
|
||||
@@ -670,6 +672,6 @@ export const validateMicrosoftTeamsChannelsSchema = z
|
||||
channelIds: z.array(z.string()).min(1)
|
||||
})
|
||||
.optional()
|
||||
.refine((data) => data === undefined || data?.channelIds.length <= 5, {
|
||||
message: "You can only select up to 5 microsoft teams channels"
|
||||
.refine((data) => data === undefined || data?.channelIds.length <= 20, {
|
||||
message: "You can only select up to 20 Microsoft Teams channels"
|
||||
});
|
||||
|
||||
@@ -201,11 +201,13 @@ export const superAdminServiceFactory = ({
|
||||
updatedData.slackClientSecret = undefined;
|
||||
}
|
||||
|
||||
let microsoftTeamsSettingsUpdated = false;
|
||||
if (data.microsoftTeamsAppId) {
|
||||
const encryptedClientId = encryptWithRoot(Buffer.from(data.microsoftTeamsAppId));
|
||||
|
||||
updatedData.encryptedMicrosoftTeamsAppId = encryptedClientId;
|
||||
updatedData.microsoftTeamsAppId = undefined;
|
||||
microsoftTeamsSettingsUpdated = true;
|
||||
}
|
||||
|
||||
if (data.microsoftTeamsClientSecret) {
|
||||
@@ -213,6 +215,7 @@ export const superAdminServiceFactory = ({
|
||||
|
||||
updatedData.encryptedMicrosoftTeamsClientSecret = encryptedClientSecret;
|
||||
updatedData.microsoftTeamsClientSecret = undefined;
|
||||
microsoftTeamsSettingsUpdated = true;
|
||||
}
|
||||
|
||||
if (data.microsoftTeamsBotId) {
|
||||
@@ -220,6 +223,7 @@ export const superAdminServiceFactory = ({
|
||||
|
||||
updatedData.encryptedMicrosoftTeamsBotId = encryptedBotId;
|
||||
updatedData.microsoftTeamsBotId = undefined;
|
||||
microsoftTeamsSettingsUpdated = true;
|
||||
}
|
||||
const updatedServerCfg = await serverCfgDAL.updateById(ADMIN_CONFIG_DB_UUID, updatedData);
|
||||
|
||||
@@ -228,7 +232,8 @@ export const superAdminServiceFactory = ({
|
||||
if (
|
||||
updatedServerCfg.encryptedMicrosoftTeamsAppId &&
|
||||
updatedServerCfg.encryptedMicrosoftTeamsClientSecret &&
|
||||
updatedServerCfg.encryptedMicrosoftTeamsBotId
|
||||
updatedServerCfg.encryptedMicrosoftTeamsBotId &&
|
||||
microsoftTeamsSettingsUpdated
|
||||
) {
|
||||
const decryptWithRoot = kmsService.decryptWithRootKey();
|
||||
decryptWithRoot(updatedServerCfg.encryptedMicrosoftTeamsBotId); // validate that we're able to decrypt the bot ID
|
||||
|
||||
Reference in New Issue
Block a user