Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update acl #181

Merged
merged 10 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts"
},
"dependencies": {
"@anzusystems/common-admin": "1.47.0-beta.8",
"@anzusystems/common-admin": "1.47.0-beta.9",
"@mdi/font": "7.4.47",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
Expand Down Expand Up @@ -65,7 +65,7 @@
"eslint-plugin-cypress": "^3.3.0",
"eslint-plugin-vue": "^9.26.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.38",
"postcss": "^8.4.39",
"postcss-html": "^1.7.0",
"prettier": "^3.3.2",
"sass": "^1.77.6",
Expand All @@ -75,6 +75,6 @@
"typescript": "5.4.5",
"vite": "^5.3.2",
"vite-plugin-vuetify": "^2.0.3",
"vue-tsc": "2.0.22"
"vue-tsc": "2.0.24"
}
}
3 changes: 2 additions & 1 deletion src/composables/auth/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineAuth } from '@anzusystems/common-admin'
import { SYSTEM_CORE_DAM } from '@/model/systems'

export const ACL = {
DAM_ASSET_CREATE: 'dam_asset_create',
Expand Down Expand Up @@ -103,7 +104,7 @@ export type AclKey = keyof typeof ACL
export type AclValue = (typeof ACL)[AclKey]

export function useAuth() {
const { can, canForAll, canForSome, useCurrentUser } = defineAuth<AclValue>('dam')
const { can, canForAll, canForSome, useCurrentUser } = defineAuth<AclValue>(SYSTEM_CORE_DAM)

return {
useCurrentUser,
Expand Down
10 changes: 7 additions & 3 deletions src/composables/system/appNotificationListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import {
DamDistributionStatus,
DamNotificationName,
initDamNotifications,
updateDamCurrentUser,
useDamNotifications,
} from '@anzusystems/common-admin'
import { damClient } from '@/services/api/clients/damClient'
import { useAuth } from '@/composables/auth/auth'
import { SYSTEM_CORE_DAM } from '@/model/systems'

export const initAppNotificationListeners = () => {
const { openConnection } = initDamNotifications()
Expand Down Expand Up @@ -46,9 +47,12 @@ export const initAppNotificationListeners = () => {
case DamNotificationName.DistributionAuthorized:
distributionListStore.authorizationMessage(event.data.distributionService, event.data.success)
break
case DamNotificationName.UserUpdated:
updateDamCurrentUser(damClient)
case DamNotificationName.UserUpdated: {
const { useCurrentUser } = useAuth()
const { fetchCurrentUser } = useCurrentUser(SYSTEM_CORE_DAM)
fetchCurrentUser(damClient)
break
}
}
})
}
15 changes: 2 additions & 13 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,17 @@ import { envConfig, loadEnvConfig } from '@/services/EnvConfigService'
import { initErrorHandler } from '@/services/ErrorHandlerApiService'
import { createPinia } from 'pinia'
import { createApp } from 'vue'
import {
AnzuSystemsCommonAdmin,
i18n,
type LanguageCode,
loadCommonFonts,
type PluginOptions,
} from '@anzusystems/common-admin'
import { AnzuSystemsCommonAdmin, i18n, type LanguageCode, loadCommonFonts } from '@anzusystems/common-admin'
import '@anzusystems/common-admin/styles'
import { damClient } from '@/services/api/clients/damClient'
import dayjs from 'dayjs'
import Duration from 'dayjs/plugin/duration'
import { type AclValue, useAuth } from '@/composables/auth/auth'

export const DEFAULT_LANGUAGE: LanguageCode = 'sk'
export const AVAILABLE_LANGUAGES: Array<LanguageCode> = ['en', 'sk']

dayjs.extend(Duration)

const { useCurrentUser } = useAuth()
const { currentUser } = useCurrentUser('dam')

loadCommonFonts()

loadEnvConfig(() => {
Expand All @@ -39,8 +29,7 @@ loadEnvConfig(() => {
.use(createPinia())
.use(vuetify)
.use(router)
.use<PluginOptions<AclValue>>(AnzuSystemsCommonAdmin, {
currentUser,
.use(AnzuSystemsCommonAdmin, {
languages: {
available: AVAILABLE_LANGUAGES,
default: DEFAULT_LANGUAGE,
Expand Down
6 changes: 5 additions & 1 deletion src/views/system/settings/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { useI18n } from 'vue-i18n'
import { inject } from 'vue'
import ActionbarWrapper from '@/components/wrappers/ActionbarWrapper.vue'
import { SYSTEM_CORE_DAM } from '@/model/systems'

const { t } = useI18n()
const configAvailableLanguages = inject<LanguageCode[]>(AvailableLanguagesSymbol, [])
Expand Down Expand Up @@ -46,7 +47,10 @@ const afterLanguageChange = async (language: LanguageCode) => {
{{ t('system.settings.locale') }}
</VCol>
<VCol>
<ALanguageSelect @after-change="afterLanguageChange" />
<ALanguageSelect
:system="SYSTEM_CORE_DAM"
@after-change="afterLanguageChange"
/>
</VCol>
</VRow>
<VRow
Expand Down
79 changes: 45 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ __metadata:
languageName: node
linkType: hard

"@anzusystems/common-admin@npm:1.47.0-beta.8":
version: 1.47.0-beta.8
resolution: "@anzusystems/common-admin@npm:1.47.0-beta.8"
"@anzusystems/common-admin@npm:1.47.0-beta.9":
version: 1.47.0-beta.9
resolution: "@anzusystems/common-admin@npm:1.47.0-beta.9"
peerDependencies:
"@vuelidate/core": 2.0.3
"@vuelidate/validators": 2.0.4
Expand All @@ -41,7 +41,7 @@ __metadata:
optional: true
vue-router:
optional: true
checksum: 10/ebaea943c5bb51109be8e88830b8e0e332c1aef0a39c5e9e5a4ab35d593f1d5d1f551da0a10a6247cd70312eaca7d141abf992ec1257320c3d0c7645666b94cc
checksum: 10/d48539889cf42e9b99180d6bbcafc183b8b5c9ef334ace6327fa6f9b79fec1db984c4a283a5d7c9bef287a33faec33ae7edadb6a933a27c3054754db12fc97a8
languageName: node
linkType: hard

Expand Down Expand Up @@ -1310,12 +1310,12 @@ __metadata:
languageName: node
linkType: hard

"@volar/language-core@npm:2.3.3, @volar/language-core@npm:~2.3.1":
version: 2.3.3
resolution: "@volar/language-core@npm:2.3.3"
"@volar/language-core@npm:2.4.0-alpha.5, @volar/language-core@npm:~2.4.0-alpha.2":
version: 2.4.0-alpha.5
resolution: "@volar/language-core@npm:2.4.0-alpha.5"
dependencies:
"@volar/source-map": "npm:2.3.3"
checksum: 10/464d9b2bf057e1923d20a0f6c71b45b07d325b30a460448bfeef5b1941b6759f68df48d761129d728e3ab8f59915e747baab8b90b0f6ad6bfe1f92114b14b8d5
"@volar/source-map": "npm:2.4.0-alpha.5"
checksum: 10/bbb76334dd63b98ed6f875c96840cd44ce14f677ba83d7da6b5948cf1ef432808971aea7029d1cee876c0a3bc060b78494a75eefaf289f5ee084a14133f15f3a
languageName: node
linkType: hard

Expand Down Expand Up @@ -1359,10 +1359,10 @@ __metadata:
languageName: node
linkType: hard

"@volar/source-map@npm:2.3.3":
version: 2.3.3
resolution: "@volar/source-map@npm:2.3.3"
checksum: 10/525362b0771828f4e318465532f6849ee37caa22d3e1d4a46df958c848df2070225c8302b42a4f3610b44ed2478e275b8d1585e620984a3003425db2769179ea
"@volar/source-map@npm:2.4.0-alpha.5":
version: 2.4.0-alpha.5
resolution: "@volar/source-map@npm:2.4.0-alpha.5"
checksum: 10/9a1722d9544dad3db30fb040c12f732050dfefced1ab2bebfe78fee881cacc20242eae477ab875eda374ac746299c644b84da2959242e3f3853751f42fa00301
languageName: node
linkType: hard

Expand All @@ -1376,14 +1376,14 @@ __metadata:
languageName: node
linkType: hard

"@volar/typescript@npm:~2.3.1":
version: 2.3.3
resolution: "@volar/typescript@npm:2.3.3"
"@volar/typescript@npm:~2.4.0-alpha.2":
version: 2.4.0-alpha.5
resolution: "@volar/typescript@npm:2.4.0-alpha.5"
dependencies:
"@volar/language-core": "npm:2.3.3"
"@volar/language-core": "npm:2.4.0-alpha.5"
path-browserify: "npm:^1.0.1"
vscode-uri: "npm:^3.0.8"
checksum: 10/da3796b2ebdf4ed70fe07cdd4473d4822ab8ac9c89f55addc5e2dd80557208d461f38ed321c8a1f17567ea47f0b8699d1448f962241b7f9b8da6287910afe524
checksum: 10/2bdba17bf0844f0e79064fa58857c295ebd81e851ce05dc5697bf02d1683934380384956c2ae40de7d009484c552ce82ed82dc4fdc9903a036706c645c3f0091
languageName: node
linkType: hard

Expand Down Expand Up @@ -1619,11 +1619,11 @@ __metadata:
languageName: node
linkType: hard

"@vue/language-core@npm:2.0.22":
version: 2.0.22
resolution: "@vue/language-core@npm:2.0.22"
"@vue/language-core@npm:2.0.24":
version: 2.0.24
resolution: "@vue/language-core@npm:2.0.24"
dependencies:
"@volar/language-core": "npm:~2.3.1"
"@volar/language-core": "npm:~2.4.0-alpha.2"
"@vue/compiler-dom": "npm:^3.4.0"
"@vue/shared": "npm:^3.4.0"
computeds: "npm:^0.0.1"
Expand All @@ -1636,7 +1636,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 10/eaf62fbddb124ae88ea5cc35dd4576d3e473820d96f221bd086fc19953c79e9d343ffa65a6a2eb88a70322aa5865290fea33212a082a510eaccd9e09964e1afd
checksum: 10/deb9fc8a7d5d0a1caed5efcd163cd4c04a2911beb882a585bdd5395cfcaedb57db1786fdfc767775c2af5c9d3023dbc80d667b09df0b41aada2c0ec9d921789c
languageName: node
linkType: hard

Expand Down Expand Up @@ -1974,7 +1974,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "adam-admin@workspace:."
dependencies:
"@anzusystems/common-admin": "npm:1.47.0-beta.8"
"@anzusystems/common-admin": "npm:1.47.0-beta.9"
"@cypress/grep": "npm:^4.0.2"
"@intlify/unplugin-vue-i18n": "npm:^4.0.0"
"@mdi/font": "npm:7.4.47"
Expand Down Expand Up @@ -2007,7 +2007,7 @@ __metadata:
jwt-decode: "npm:^4.0.0"
npm-run-all: "npm:^4.1.5"
pinia: "npm:^2.1.7"
postcss: "npm:^8.4.38"
postcss: "npm:^8.4.39"
postcss-html: "npm:^1.7.0"
prettier: "npm:^3.3.2"
rusha: "npm:^0.8.14"
Expand All @@ -2025,7 +2025,7 @@ __metadata:
vue: "npm:3.4.31"
vue-i18n: "npm:^9.13.1"
vue-router: "npm:^4.4.0"
vue-tsc: "npm:2.0.22"
vue-tsc: "npm:2.0.24"
vuetify: "npm:^3.6.10"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -6620,6 +6620,17 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:^8.4.39":
version: 8.4.39
resolution: "postcss@npm:8.4.39"
dependencies:
nanoid: "npm:^3.3.7"
picocolors: "npm:^1.0.1"
source-map-js: "npm:^1.2.0"
checksum: 10/ad9c1add892c96433b9a5502878201ede4a20c4ce02d056251f61f8d9a3e5426dab3683fe5a086edfa78a1a19f2b4988c8cea02c5122136d29758cb5a17e2621
languageName: node
linkType: hard

"prelude-ls@npm:^1.2.1":
version: 1.2.1
resolution: "prelude-ls@npm:1.2.1"
Expand Down Expand Up @@ -8649,18 +8660,18 @@ __metadata:
languageName: node
linkType: hard

"vue-tsc@npm:2.0.22":
version: 2.0.22
resolution: "vue-tsc@npm:2.0.22"
"vue-tsc@npm:2.0.24":
version: 2.0.24
resolution: "vue-tsc@npm:2.0.24"
dependencies:
"@volar/typescript": "npm:~2.3.1"
"@vue/language-core": "npm:2.0.22"
"@volar/typescript": "npm:~2.4.0-alpha.2"
"@vue/language-core": "npm:2.0.24"
semver: "npm:^7.5.4"
peerDependencies:
typescript: "*"
typescript: ">=5.0.0"
bin:
vue-tsc: bin/vue-tsc.js
checksum: 10/4dd23da9d10d071b149600646e32f8cb5c8e38be417e3993b877ec8802b669f164558317f1992c9596a376dd9315cedd12fcd132b5513a2f937becdc3404dd26
vue-tsc: ./bin/vue-tsc.js
checksum: 10/bbc0bc187db09b14e6a7f705abe533e8d8177068c497aab24ae8bdf542bdb3ea26ab4dc8165fec7c7d88649c3bd1f5c44c322b0ad3a4b953bfb3c666f527b06c
languageName: node
linkType: hard

Expand Down
Loading