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

[full-ci] Bump (peer)dependencies #7200

Merged
merged 2 commits into from
Aug 16, 2022
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
5 changes: 3 additions & 2 deletions packages/web-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@uppy/tus": "^2.4.0",
"@uppy/xhr-upload": "^2.1.0",
"@vue/composition-api": "^1.6.2",
"axios": "^0.26.1",
"axios": "^0.27.1",
"cross-fetch": "^3.0.6",
"easygettext": "https://github.com/owncloud/easygettext/archive/refs/tags/v2.18.1-oc.tar.gz",
"filesize": "^9.0.11",
Expand Down Expand Up @@ -54,11 +54,12 @@
"vuex-extensions": "^1.1.5",
"vuex-router-sync": "^5.0.0",
"web-pkg": "*",
"webdav": "4.9.0",
"webdav": "4.10.0",
"webfontloader": "^1.6.28",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@jest/globals": "^27.0.0",
"@types/luxon": "^2.3.1",
"@types/semver": "^7.3.8"
}
Expand Down
81 changes: 51 additions & 30 deletions packages/web-runtime/src/services/auth/userManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,37 +168,14 @@ export class UserManager extends OidcUserManager {
accessToken
)
graphUser = await graphClient.users.getMe()
const {
data: { bundles: roles }
} = await axios.post(
'/api/v0/settings/roles-list',
{},
{
headers: {
authorization: `Bearer ${accessToken}`
}
}
)

const [roles, settings] = await Promise.all([
this.fetchRoles({ accessToken }),
this.fetchSettings()
])
this.store.commit('SET_ROLES', roles)
this.store.commit('SET_SETTINGS_VALUES', settings)

const userAssignmentResponse = await axios.post(
'/api/v0/settings/assignments-list',
{
account_uuid: graphUser.data.id
},
{
headers: {
authorization: `Bearer ${accessToken}`
}
}
)
const assignments = userAssignmentResponse.data?.assignments
const roleAssignment = assignments.find((assignment) => 'roleId' in assignment)

if (roleAssignment) {
role = roles.find((role) => role.id === roleAssignment.roleId)
}
role = await this.fetchRole({ graphUser, accessToken, roles })
}
const [user, userGroups] = await Promise.all([
await this.clientService.owncloudSdk.users.getUser(login.id),
Expand All @@ -218,8 +195,52 @@ export class UserManager extends OidcUserManager {
if (!this.store.getters.capabilities.spaces?.enabled && user.quota) {
this.store.commit('SET_QUOTA', user.quota)
}
}

await this.store.dispatch('loadSettingsValues')
private async fetchRoles({ accessToken = '' }): Promise<any> {
try {
const {
data: { bundles: roles }
} = await axios.post(
'/api/v0/settings/roles-list',
{},
{
headers: {
authorization: `Bearer ${accessToken}`
}
}
)
return roles
} catch (e) {
console.error(e)
return []
}
}

private async fetchSettings(): Promise<any> {
try {
return await this.clientService.owncloudSdk.settings.getSettingsValues()
} catch (e) {
console.error(e)
return null
}
}

private async fetchRole({ graphUser, accessToken, roles }): Promise<any> {
const userAssignmentResponse = await axios.post(
'/api/v0/settings/assignments-list',
{
account_uuid: graphUser.data.id
},
{
headers: {
authorization: `Bearer ${accessToken}`
}
}
)
const assignments = userAssignmentResponse.data?.assignments
const roleAssignment = assignments.find((assignment) => 'roleId' in assignment)
return roleAssignment ? roles.find((role) => role.id === roleAssignment.roleId) : null
}

private async fetchCapabilities({ accessToken = '' }): Promise<void> {
Expand Down
19 changes: 0 additions & 19 deletions packages/web-runtime/src/store/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ const state = {
const actions = {
clearSettingsValues({ commit }) {
commit('SET_SETTINGS_VALUES', null)
},

async loadSettingsValues({ commit, state, dispatch }) {
const oldSettingsValues = state.settingsValues
commit('SET_SETTINGS_VALUES', null)
try {
const values = await this._vm.$client.settings.getSettingsValues()
commit('SET_SETTINGS_VALUES', values)
} catch (error) {
commit('SET_SETTINGS_VALUES', oldSettingsValues)
dispatch('showMessage', {
title: 'Failed to load settings values.',
desc: error.response.statusText,
status: 'danger',
autoClose: {
enabled: true
}
})
}
}
}

Expand Down
Loading