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