mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-21 07:59:01 +00:00
[post-modularisation] Fixing audit-log filters (#12652)
* fixed: audit log user search filter * fixed: added invite user log --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
This commit is contained in:
parent
258469f78d
commit
bdcd84bef5
4 changed files with 13 additions and 17 deletions
|
|
@ -17,7 +17,7 @@ export const organizationService = {
|
|||
|
||||
function getUsersByValue(searchInput) {
|
||||
const requestOptions = { method: 'GET', headers: authHeader(), credentials: 'include' };
|
||||
return fetch(`${config.apiUrl}/organizations/users/suggest?input=${searchInput}`, requestOptions).then(
|
||||
return fetch(`${config.apiUrl}/organization-users/users/suggest?input=${searchInput}`, requestOptions).then(
|
||||
handleResponse
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export class OrganizationUsersController implements IOrganizationUsersController
|
|||
@InitFeature(FEATURE_KEY.SUGGEST_USERS)
|
||||
@Get('users/suggest')
|
||||
async getUserSuggestions(@User() user, @Query('input') searchInput) {
|
||||
const users = await this.organizationUsersService.fetchUsersByValue(user?.organization_id, searchInput);
|
||||
const users = await this.organizationUsersService.fetchUsersByValue(user?.organizationId, searchInput);
|
||||
const response = {
|
||||
users,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ export class OrganizationUsersRepository extends Repository<OrganizationUser> {
|
|||
|
||||
return organizationUsers.map((row) => ({
|
||||
email: row.user_email,
|
||||
firstName: row.user_firstName,
|
||||
lastName: row.user_lastName,
|
||||
name: `${row.user_firstName || ''} ${row.user_lastName || ''}`.trim(),
|
||||
firstName: row.user_first_name,
|
||||
lastName: row.user_last_name,
|
||||
name: `${row.user_first_name || ''} ${row.user_last_name || ''}`.trim(),
|
||||
id: row.organization_user_id,
|
||||
userId: row.user_id,
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ import { SessionUtilService } from '@modules/session/util.service';
|
|||
import { SetupOrganizationsUtilService } from '@modules/setup-organization/util.service';
|
||||
import { IOrganizationUsersUtilService } from './interfaces/IUtilService';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { AUDIT_LOGS_REQUEST_CONTEXT_KEY } from '@modules/app/constants';
|
||||
import { RequestContext } from '@modules/request-context/service';
|
||||
@Injectable()
|
||||
export class OrganizationUsersUtilService implements IOrganizationUsersUtilService {
|
||||
constructor(
|
||||
|
|
@ -509,18 +511,12 @@ export class OrganizationUsersUtilService implements IOrganizationUsersUtilServi
|
|||
!user || !!user.invitationToken
|
||||
);
|
||||
|
||||
this.eventEmitter.emit(
|
||||
'auditLogEntry',
|
||||
{
|
||||
userId: currentUser.id,
|
||||
organizationId: currentOrganization.id,
|
||||
resourceId: currentOrganization.id,
|
||||
resourceName: updatedUser.email,
|
||||
resourceType: MODULES.USER,
|
||||
actionType: MODULE_INFO.USER_INVITE,
|
||||
},
|
||||
manager
|
||||
);
|
||||
RequestContext.setLocals(AUDIT_LOGS_REQUEST_CONTEXT_KEY, {
|
||||
userId: currentUser.id,
|
||||
organizationId: currentOrganization.id,
|
||||
resourceId: currentOrganization.id,
|
||||
resourceName: updatedUser.email,
|
||||
});
|
||||
|
||||
return organizationUser;
|
||||
}, manager);
|
||||
|
|
|
|||
Loading…
Reference in a new issue