package ctxhelper import ( "context" "math" "perms-system-server/internal/consts" "perms-system-server/internal/loaders" "perms-system-server/internal/middleware" ) func SuperAdminCtx() context.Context { return middleware.WithUserDetails(context.Background(), &loaders.UserDetails{ UserId: 1, Username: "superadmin", IsSuperAdmin: true, MemberType: consts.MemberTypeSuperAdmin, Status: consts.StatusEnabled, ProductCode: "test_product", MinPermsLevel: math.MaxInt64, }) } func SuperAdminCtxWithUserId(userId int64) context.Context { return middleware.WithUserDetails(context.Background(), &loaders.UserDetails{ UserId: userId, Username: "superadmin", IsSuperAdmin: true, MemberType: consts.MemberTypeSuperAdmin, Status: consts.StatusEnabled, ProductCode: "test_product", MinPermsLevel: math.MaxInt64, }) } func AdminCtx(productCode string) context.Context { return middleware.WithUserDetails(context.Background(), &loaders.UserDetails{ UserId: 2, Username: "admin", IsSuperAdmin: false, MemberType: consts.MemberTypeAdmin, Status: consts.StatusEnabled, ProductCode: productCode, DeptId: 1, DeptPath: "/1/", MinPermsLevel: math.MaxInt64, }) } func DeveloperCtx(productCode string) context.Context { return middleware.WithUserDetails(context.Background(), &loaders.UserDetails{ UserId: 3, Username: "developer", IsSuperAdmin: false, MemberType: consts.MemberTypeDeveloper, Status: consts.StatusEnabled, ProductCode: productCode, DeptId: 1, DeptPath: "/1/", MinPermsLevel: math.MaxInt64, }) } func MemberCtx(productCode string) context.Context { return middleware.WithUserDetails(context.Background(), &loaders.UserDetails{ UserId: 4, Username: "member", IsSuperAdmin: false, MemberType: consts.MemberTypeMember, Status: consts.StatusEnabled, ProductCode: productCode, DeptId: 1, DeptPath: "/1/", MinPermsLevel: 100, }) } func CustomCtx(ud *loaders.UserDetails) context.Context { return middleware.WithUserDetails(context.Background(), ud) }