Commit 54a769608c3a070962e608db98e3f0ab37e066a5

Authored by 温伟
2 parents b1baf317 5cd574de

Merge branch 'fix/edge-get-token' into 'main_dev'

fix: 修复边端组态无权限控制

See merge request yunteng/thingskit-scada!255
  1 +import { isFromEdge } from './useParseParams'
1 2 import { getCurrentRolePermission } from '@/api/sys'
2 3 import { useContentDataStoreWithOut } from '@/store/modules/contentData'
3 4 import { isShareMode } from '@/utils/env'
... ... @@ -6,6 +7,10 @@ export function useAuth() {
6 7 const contentDataStore = useContentDataStoreWithOut()
7 8 const getAuthInfo = async () => {
8 9 const result = { permissions: [] as string[], hasPreview: true, hasDesign: true }
  10 +
  11 + if (isFromEdge())
  12 + return result
  13 +
9 14 if (isShareMode()) return result
10 15
11 16 const permissions = await getCurrentRolePermission()
... ...
  1 +import { isFromEdge } from '@/core/LoadData/module/useParseParams'
1 2 import { isDevMode } from '@/utils/env'
2 3
3 4 // System default cache time, in seconds
... ... @@ -10,5 +11,5 @@ export const cacheCipher = {
10 11 }
11 12
12 13 // Whether the system cache is encrypted using aes
13   -export const enableStorageEncryption = !isDevMode()
  14 +export const enableStorageEncryption = !isFromEdge() && !isDevMode()
14 15
... ...
... ... @@ -3,7 +3,6 @@ import { isProdMode } from '../env'
3 3 import { cacheCipher } from '@/settings/encryptionSetting'
4 4 import type { EncryptionParams } from '@/utils/cipher'
5 5 import { AesEncryption } from '@/utils/cipher'
6   -import { isFromEdge } from '@/core/LoadData/module/useParseParams'
7 6
8 7 export interface CreateStorageParams extends EncryptionParams {
9 8 prefixKey: string
... ... @@ -17,7 +16,7 @@ export const createStorage = ({
17 16 key = cacheCipher.key,
18 17 iv = cacheCipher.iv,
19 18 timeout = null,
20   - hasEncrypt = !isFromEdge() && isProdMode(),
  19 + hasEncrypt = isProdMode(),
21 20 }: Partial<CreateStorageParams> = {}) => {
22 21 if (hasEncrypt && [key.length, iv.length].some(item => item !== 16))
23 22 throw new Error('When hasEncrypt is true, the key or iv must be 16 bits!')
... ...