@@ -429,6 +429,35 @@ function authorizeRecordingUser(username) {
429429 }
430430}
431431
432+ /**
433+ * Returns true if the specified user has the Speech-To-Text authorization.
434+ *
435+ * @method authorizeSttUser
436+ * @param {string } username The username
437+ * @return {boolean } True if the user has the Speech-To-Text authorization.
438+ */
439+ function authorizeSttUser ( username ) {
440+ try {
441+ // check parameter
442+ if ( typeof username !== 'string' ) {
443+ throw new Error ( 'wrong parameters: ' + JSON . stringify ( arguments ) ) ;
444+ }
445+
446+ var profid = getUserProfileId ( username ) ;
447+
448+ return (
449+ profiles [ profid ] !== undefined &&
450+ profiles [ profid ] . macro_permissions . nethvoice_cti . value === true &&
451+ profiles [ profid ] . macro_permissions . nethvoice_cti . permissions . satellite_stt . value === true
452+ ) ;
453+
454+ } catch ( err ) {
455+ logger . log . error ( IDLOG , err . stack ) ;
456+ // in the case of exception it returns false for security reasons
457+ return false ;
458+ }
459+ }
460+
432461/**
433462 * Returns true if the specified user has the authorization to view the lost calls of the queues.
434463 *
@@ -2189,6 +2218,7 @@ exports.authorizeAdminCdrUser = authorizeAdminCdrUser;
21892218exports . getUserAuthorizations = getUserAuthorizations ;
21902219exports . authorizeAdminPhoneUser = authorizeAdminPhoneUser ;
21912220exports . authorizeRecordingUser = authorizeRecordingUser ;
2221+ exports . authorizeSttUser = authorizeSttUser ;
21922222exports . authorizePhonebookUser = authorizePhonebookUser ;
21932223exports . authorizeStreamingUser = authorizeStreamingUser ;
21942224exports . authorizeRemoteSiteUser = authorizeRemoteSiteUser ;
0 commit comments