Compare commits

...

5 Commits

Author SHA1 Message Date
vikrantgupta25
39566bfbec chore: capture log messages in sentry 2024-12-03 23:42:53 +05:30
vikrantgupta25
1a7ea098a4 feat: log the create new dashboard permissions 2024-12-03 17:40:08 +05:30
Vikrant Gupta
1934f743d6 Merge branch 'develop' into debugging-rbac-issue 2024-12-03 14:36:29 +05:30
vikrantgupta25
08ef66e185 chore: logging 2024-12-03 14:35:05 +05:30
vikrantgupta25
bb4c42ec22 chore: added debug statements for rbac issue 2024-12-03 14:27:24 +05:30
3 changed files with 22 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import * as Sentry from '@sentry/react';
import getLocalStorageApi from 'api/browser/localstorage/get';
import setLocalStorageApi from 'api/browser/localstorage/set';
import getUserApi from 'api/user/getUser';
@@ -46,7 +47,12 @@ const afterLogin = async (
});
const { payload } = getUserResponse;
// TODO remove this later, logging the role for debugging some issue
Sentry.captureEvent({
message: `getUserResponse: email: ${payload.email}, role: ${payload.role}`,
level: 'info',
});
console.trace('[getUserResponse]:', payload);
store.dispatch<AppActions>({
type: UPDATE_USER,
payload: {

View File

@@ -4,6 +4,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
import './DashboardList.styles.scss';
import * as Sentry from '@sentry/react';
import { Color } from '@signozhq/design-tokens';
import {
Button,
@@ -95,8 +96,14 @@ function DashboardsList(): JSX.Element {
refetch: refetchDashboardList,
} = useGetAllDashboard();
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
const { role, user } = useSelector<AppState, AppReducer>((state) => state.app);
// TODO remove this later, logging the role for debugging some issue
Sentry.captureEvent({
message: `${user?.email}, has role: ${role}`,
level: 'info',
});
console.info(user?.email, 'has role', role);
const {
listSortOrder: sortOrder,
setListSortOrder: setSortOrder,
@@ -109,6 +116,12 @@ function DashboardsList(): JSX.Element {
['action', 'create_new_dashboards'],
role,
);
// log the permissions to createNewDashboard
Sentry.captureEvent({
message: `createNewDashboard permission: ${createNewDashboard}, user: ${user?.email}`,
level: 'info',
});
console.info('createNewDashboard permission: ', createNewDashboard);
const [
showNewDashboardTemplatesModal,

View File

@@ -2145,6 +2145,7 @@ func (aH *APIHandler) getUser(w http.ResponseWriter, r *http.Request) {
// No need to send password hash for the user object.
user.Password = ""
zap.L().Info("[getUser] Response:", zap.String("userId", user.Id), zap.String("email", user.Email), zap.String("role", user.Role))
aH.WriteJSON(w, r, user)
}