Merge pull request #20876 from nextcloud/warn/js/settings
Fix some linter warnings in settings
This commit is contained in:
commit
68b2102062
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -69,6 +69,7 @@
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { Multiselect } from '@nextcloud/vue'
|
import { Multiselect } from '@nextcloud/vue'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminTwoFactor',
|
name: 'AdminTwoFactor',
|
||||||
|
@ -124,7 +125,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
searchGroup: _.debounce(function(query) {
|
searchGroup: _.debounce(function(query) {
|
||||||
this.loadingGroups = true
|
this.loadingGroups = true
|
||||||
axios.get(OC.linkToOCS(`cloud/groups?offset=0&search=${encodeURIComponent(query)}&limit=20`, 2))
|
axios.get(generateOcsUrl(`cloud/groups?offset=0&search=${encodeURIComponent(query)}&limit=20`, 2))
|
||||||
.then(res => res.data.ocs)
|
.then(res => res.data.ocs)
|
||||||
.then(ocs => ocs.data.groups)
|
.then(ocs => ocs.data.groups)
|
||||||
.then(groups => { this.groups = _.sortedUniq(_.uniq(this.groups.concat(groups))) })
|
.then(groups => { this.groups = _.sortedUniq(_.uniq(this.groups.concat(groups))) })
|
||||||
|
@ -140,7 +141,7 @@ export default {
|
||||||
enforcedGroups: this.enforcedGroups,
|
enforcedGroups: this.enforcedGroups,
|
||||||
excludedGroups: this.excludedGroups,
|
excludedGroups: this.excludedGroups,
|
||||||
}
|
}
|
||||||
axios.put(OC.generateUrl('/settings/api/admin/twofactorauth'), data)
|
axios.put(generateUrl('/settings/api/admin/twofactorauth'), data)
|
||||||
.then(resp => resp.data)
|
.then(resp => resp.data)
|
||||||
.then(state => {
|
.then(state => {
|
||||||
this.state = state
|
this.state = state
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
<img :src="scoreImage" class="app-score-image">
|
<img :src="scoreImage" class="app-score-image">
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { imagePath } from '@nextcloud/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppScore',
|
name: 'AppScore',
|
||||||
props: ['score'],
|
props: ['score'],
|
||||||
|
@ -31,7 +33,7 @@ export default {
|
||||||
scoreImage() {
|
scoreImage() {
|
||||||
const score = Math.round(this.score * 10)
|
const score = Math.round(this.score * 10)
|
||||||
const imageName = 'rating/s' + score + '.svg'
|
const imageName = 'rating/s' + score + '.svg'
|
||||||
return OC.imagePath('core', imageName)
|
return imagePath('core', imageName)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<script>
|
<script>
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import confirmPassword from '@nextcloud/password-confirmation'
|
import confirmPassword from '@nextcloud/password-confirmation'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
import AuthTokenList from './AuthTokenList'
|
import AuthTokenList from './AuthTokenList'
|
||||||
import AuthTokenSetupDialogue from './AuthTokenSetupDialogue'
|
import AuthTokenSetupDialogue from './AuthTokenSetupDialogue'
|
||||||
|
@ -80,7 +81,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseUrl: OC.generateUrl('/settings/personal/authtokens'),
|
baseUrl: generateUrl('/settings/personal/authtokens'),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<button class="button"
|
<button class="button"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@click="submit">
|
@click="submit">
|
||||||
{{ t('settings', 'Create new app password') }}
|
{{ t('settings', 'Create new app password') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
@ -79,6 +79,7 @@
|
||||||
<script>
|
<script>
|
||||||
import QR from '@chenfengyuan/vue-qrcode'
|
import QR from '@chenfengyuan/vue-qrcode'
|
||||||
import confirmPassword from '@nextcloud/password-confirmation'
|
import confirmPassword from '@nextcloud/password-confirmation'
|
||||||
|
import { getRootUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AuthTokenSetupDialogue',
|
name: 'AuthTokenSetupDialogue',
|
||||||
|
@ -141,7 +142,7 @@ export default {
|
||||||
this.loginName = token.loginName
|
this.loginName = token.loginName
|
||||||
this.appPassword = token.token
|
this.appPassword = token.token
|
||||||
|
|
||||||
const server = window.location.protocol + '//' + window.location.host + OC.getRootPath()
|
const server = window.location.protocol + '//' + window.location.host + getRootUrl()
|
||||||
this.qrUrl = `nc://login/user:${token.loginName}&password:${token.token}&server:${server}`
|
this.qrUrl = `nc://login/user:${token.loginName}&password:${token.token}&server:${server}`
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
|
@ -87,8 +87,8 @@ export default {
|
||||||
httpWarning: Boolean,
|
httpWarning: Boolean,
|
||||||
isHttps: {
|
isHttps: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
{{ t('settings', 'Your browser does not support WebAuthn.') }}
|
{{ t('settings', 'Your browser does not support WebAuthn.') }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<AddDevice v-if="hasPublicKeyCredential" :isHttps="isHttps" @added="deviceAdded" />
|
<AddDevice v-if="hasPublicKeyCredential" :is-https="isHttps" @added="deviceAdded" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
|
@ -158,7 +160,7 @@ export default {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
generateAvatar(user, size = 32) {
|
generateAvatar(user, size = 32) {
|
||||||
return OC.generateUrl(
|
return generateUrl(
|
||||||
'/avatar/{user}/{size}?v={version}',
|
'/avatar/{user}/{size}?v={version}',
|
||||||
{
|
{
|
||||||
user: user,
|
user: user,
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
// Dynamic loading
|
// Dynamic loading
|
||||||
const Users = () => import('./views/Users')
|
const Users = () => import('./views/Users')
|
||||||
|
@ -43,7 +44,7 @@ export default new Router({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
// if index.php is in the url AND we got this far, then it's working:
|
// if index.php is in the url AND we got this far, then it's working:
|
||||||
// let's keep using index.php in the url
|
// let's keep using index.php in the url
|
||||||
base: OC.generateUrl(''),
|
base: generateUrl(''),
|
||||||
linkActiveClass: 'active',
|
linkActiveClass: 'active',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,15 +35,15 @@ export default {
|
||||||
* you'll need to be careful when using it.
|
* you'll need to be careful when using it.
|
||||||
* e.g
|
* e.g
|
||||||
* // store
|
* // store
|
||||||
* action(context) {
|
* action(context) {
|
||||||
* return api.requireAdmin().then((response) => {
|
* return api.requireAdmin().then((response) => {
|
||||||
* return api.get('url')
|
* return api.get('url')
|
||||||
* .then((response) => {API success})
|
* .then((response) => {API success})
|
||||||
* .catch((error) => {API failure});
|
* .catch((error) => {API failure});
|
||||||
* }).catch((error) => {requireAdmin failure});
|
* }).catch((error) => {requireAdmin failure});
|
||||||
* }
|
* }
|
||||||
* // vue
|
* // vue
|
||||||
* this.$store.dispatch('action').then(() => {always executed})
|
* this.$store.dispatch('action').then(() => {always executed})
|
||||||
*
|
*
|
||||||
* Since Promise.then().catch().then() will always execute the last then
|
* Since Promise.then().catch().then() will always execute the last then
|
||||||
* this.$store.dispatch('action').then will always be executed
|
* this.$store.dispatch('action').then will always be executed
|
||||||
|
@ -52,11 +52,11 @@ export default {
|
||||||
* you will need to throw a new error in the api.get.catch()
|
* you will need to throw a new error in the api.get.catch()
|
||||||
*
|
*
|
||||||
* e.g
|
* e.g
|
||||||
* api.requireAdmin().then((response) => {
|
* api.requireAdmin().then((response) => {
|
||||||
* api.get('url')
|
* api.get('url')
|
||||||
* .then((response) => {API success})
|
* .then((response) => {API success})
|
||||||
* .catch((error) => {throw error;});
|
* .catch((error) => {throw error;});
|
||||||
* }).catch((error) => {requireAdmin OR API failure});
|
* }).catch((error) => {requireAdmin OR API failure});
|
||||||
*
|
*
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import api from './api'
|
import api from './api'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
apps: [],
|
apps: [],
|
||||||
|
@ -165,7 +166,7 @@ const actions = {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
context.commit('startLoading', apps)
|
context.commit('startLoading', apps)
|
||||||
context.commit('startLoading', 'install')
|
context.commit('startLoading', 'install')
|
||||||
return api.post(OC.generateUrl(`settings/apps/enable`), { appIds: apps, groups: groups })
|
return api.post(generateUrl(`settings/apps/enable`), { appIds: apps, groups: groups })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('stopLoading', apps)
|
context.commit('stopLoading', apps)
|
||||||
context.commit('stopLoading', 'install')
|
context.commit('stopLoading', 'install')
|
||||||
|
@ -174,7 +175,7 @@ const actions = {
|
||||||
})
|
})
|
||||||
|
|
||||||
// check for server health
|
// check for server health
|
||||||
return api.get(OC.generateUrl('apps/files'))
|
return api.get(generateUrl('apps/files'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (response.data.update_required) {
|
if (response.data.update_required) {
|
||||||
OC.dialogs.info(
|
OC.dialogs.info(
|
||||||
|
@ -223,7 +224,7 @@ const actions = {
|
||||||
return api.requireAdmin().then(() => {
|
return api.requireAdmin().then(() => {
|
||||||
context.commit('startLoading', apps)
|
context.commit('startLoading', apps)
|
||||||
context.commit('startLoading', 'install')
|
context.commit('startLoading', 'install')
|
||||||
return api.post(OC.generateUrl(`settings/apps/force`), { appId })
|
return api.post(generateUrl(`settings/apps/force`), { appId })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// TODO: find a cleaner solution
|
// TODO: find a cleaner solution
|
||||||
location.reload()
|
location.reload()
|
||||||
|
@ -248,7 +249,7 @@ const actions = {
|
||||||
}
|
}
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
context.commit('startLoading', apps)
|
context.commit('startLoading', apps)
|
||||||
return api.post(OC.generateUrl(`settings/apps/disable`), { appIds: apps })
|
return api.post(generateUrl(`settings/apps/disable`), { appIds: apps })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('stopLoading', apps)
|
context.commit('stopLoading', apps)
|
||||||
apps.forEach(_appId => {
|
apps.forEach(_appId => {
|
||||||
|
@ -265,7 +266,7 @@ const actions = {
|
||||||
uninstallApp(context, { appId }) {
|
uninstallApp(context, { appId }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
context.commit('startLoading', appId)
|
context.commit('startLoading', appId)
|
||||||
return api.get(OC.generateUrl(`settings/apps/uninstall/${appId}`))
|
return api.get(generateUrl(`settings/apps/uninstall/${appId}`))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('stopLoading', appId)
|
context.commit('stopLoading', appId)
|
||||||
context.commit('uninstallApp', appId)
|
context.commit('uninstallApp', appId)
|
||||||
|
@ -282,7 +283,7 @@ const actions = {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
context.commit('startLoading', appId)
|
context.commit('startLoading', appId)
|
||||||
context.commit('startLoading', 'install')
|
context.commit('startLoading', 'install')
|
||||||
return api.get(OC.generateUrl(`settings/apps/update/${appId}`))
|
return api.get(generateUrl(`settings/apps/update/${appId}`))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('stopLoading', 'install')
|
context.commit('stopLoading', 'install')
|
||||||
context.commit('stopLoading', appId)
|
context.commit('stopLoading', appId)
|
||||||
|
@ -299,7 +300,7 @@ const actions = {
|
||||||
|
|
||||||
getAllApps(context) {
|
getAllApps(context) {
|
||||||
context.commit('startLoading', 'list')
|
context.commit('startLoading', 'list')
|
||||||
return api.get(OC.generateUrl(`settings/apps/list`))
|
return api.get(generateUrl(`settings/apps/list`))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('setAllApps', response.data.apps)
|
context.commit('setAllApps', response.data.apps)
|
||||||
context.commit('stopLoading', 'list')
|
context.commit('stopLoading', 'list')
|
||||||
|
@ -310,7 +311,7 @@ const actions = {
|
||||||
|
|
||||||
getCategories(context) {
|
getCategories(context) {
|
||||||
context.commit('startLoading', 'categories')
|
context.commit('startLoading', 'categories')
|
||||||
return api.get(OC.generateUrl('settings/apps/categories'))
|
return api.get(generateUrl('settings/apps/categories'))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.length > 0) {
|
if (response.data.length > 0) {
|
||||||
context.commit('appendCategories', response.data)
|
context.commit('appendCategories', response.data)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import api from './api'
|
import api from './api'
|
||||||
|
import { generateOcsUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
const state = {}
|
const state = {}
|
||||||
const mutations = {}
|
const mutations = {}
|
||||||
|
@ -38,7 +39,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
setAppConfig(context, { app, key, value }) {
|
setAppConfig(context, { app, key, value }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), { value: value })
|
return api.post(generateOcsUrl(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), { value: value })
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { app, key, value, error }))
|
}).catch((error) => context.commit('API_FAILURE', { app, key, value, error }))
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import api from './api'
|
import api from './api'
|
||||||
|
import { generateOcsUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
const orderGroups = function(groups, orderBy) {
|
const orderGroups = function(groups, orderBy) {
|
||||||
/* const SORT_USERCOUNT = 1;
|
/* const SORT_USERCOUNT = 1;
|
||||||
|
@ -205,7 +206,7 @@ const actions = {
|
||||||
search = typeof search === 'string' ? search : ''
|
search = typeof search === 'string' ? search : ''
|
||||||
group = typeof group === 'string' ? group : ''
|
group = typeof group === 'string' ? group : ''
|
||||||
if (group !== '') {
|
if (group !== '') {
|
||||||
return api.get(OC.linkToOCS(`cloud/groups/${encodeURIComponent(encodeURIComponent(group))}/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
return api.get(generateOcsUrl(`cloud/groups/${encodeURIComponent(encodeURIComponent(group))}/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
||||||
context.commit('appendUsers', response.data.ocs.data.users)
|
context.commit('appendUsers', response.data.ocs.data.users)
|
||||||
|
@ -216,7 +217,7 @@ const actions = {
|
||||||
.catch((error) => context.commit('API_FAILURE', error))
|
.catch((error) => context.commit('API_FAILURE', error))
|
||||||
}
|
}
|
||||||
|
|
||||||
return api.get(OC.linkToOCS(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
return api.get(generateOcsUrl(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
||||||
context.commit('appendUsers', response.data.ocs.data.users)
|
context.commit('appendUsers', response.data.ocs.data.users)
|
||||||
|
@ -230,7 +231,7 @@ const actions = {
|
||||||
getGroups(context, { offset, limit, search }) {
|
getGroups(context, { offset, limit, search }) {
|
||||||
search = typeof search === 'string' ? search : ''
|
search = typeof search === 'string' ? search : ''
|
||||||
const limitParam = limit === -1 ? '' : `&limit=${limit}`
|
const limitParam = limit === -1 ? '' : `&limit=${limit}`
|
||||||
return api.get(OC.linkToOCS(`cloud/groups?offset=${offset}&search=${search}${limitParam}`, 2))
|
return api.get(generateOcsUrl(`cloud/groups?offset=${offset}&search=${search}${limitParam}`, 2))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (Object.keys(response.data.ocs.data.groups).length > 0) {
|
if (Object.keys(response.data.ocs.data.groups).length > 0) {
|
||||||
response.data.ocs.data.groups.forEach(function(group) {
|
response.data.ocs.data.groups.forEach(function(group) {
|
||||||
|
@ -254,7 +255,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
getUsersFromList(context, { offset, limit, search }) {
|
getUsersFromList(context, { offset, limit, search }) {
|
||||||
search = typeof search === 'string' ? search : ''
|
search = typeof search === 'string' ? search : ''
|
||||||
return api.get(OC.linkToOCS(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
return api.get(generateOcsUrl(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
if (Object.keys(response.data.ocs.data.users).length > 0) {
|
||||||
context.commit('appendUsers', response.data.ocs.data.users)
|
context.commit('appendUsers', response.data.ocs.data.users)
|
||||||
|
@ -275,7 +276,7 @@ const actions = {
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
getUsersFromGroup(context, { groupid, offset, limit }) {
|
getUsersFromGroup(context, { groupid, offset, limit }) {
|
||||||
return api.get(OC.linkToOCS(`cloud/users/${encodeURIComponent(encodeURIComponent(groupid))}/details?offset=${offset}&limit=${limit}`, 2))
|
return api.get(generateOcsUrl(`cloud/users/${encodeURIComponent(encodeURIComponent(groupid))}/details?offset=${offset}&limit=${limit}`, 2))
|
||||||
.then((response) => context.commit('getUsersFromList', response.data.ocs.data.users))
|
.then((response) => context.commit('getUsersFromList', response.data.ocs.data.users))
|
||||||
.catch((error) => context.commit('API_FAILURE', error))
|
.catch((error) => context.commit('API_FAILURE', error))
|
||||||
},
|
},
|
||||||
|
@ -297,7 +298,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
addGroup(context, gid) {
|
addGroup(context, gid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/groups`, 2), { groupid: gid })
|
return api.post(generateOcsUrl(`cloud/groups`, 2), { groupid: gid })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
context.commit('addGroup', { gid: gid, displayName: gid })
|
context.commit('addGroup', { gid: gid, displayName: gid })
|
||||||
return { gid: gid, displayName: gid }
|
return { gid: gid, displayName: gid }
|
||||||
|
@ -320,7 +321,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
removeGroup(context, gid) {
|
removeGroup(context, gid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.delete(OC.linkToOCS(`cloud/groups/${encodeURIComponent(encodeURIComponent(gid))}`, 2))
|
return api.delete(generateOcsUrl(`cloud/groups/${encodeURIComponent(encodeURIComponent(gid))}`, 2))
|
||||||
.then((response) => context.commit('removeGroup', gid))
|
.then((response) => context.commit('removeGroup', gid))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { gid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { gid, error }))
|
||||||
|
@ -337,7 +338,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
addUserGroup(context, { userid, gid }) {
|
addUserGroup(context, { userid, gid }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/users/${userid}/groups`, 2), { groupid: gid })
|
return api.post(generateOcsUrl(`cloud/users/${userid}/groups`, 2), { groupid: gid })
|
||||||
.then((response) => context.commit('addUserGroup', { userid, gid }))
|
.then((response) => context.commit('addUserGroup', { userid, gid }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -354,7 +355,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
removeUserGroup(context, { userid, gid }) {
|
removeUserGroup(context, { userid, gid }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.delete(OC.linkToOCS(`cloud/users/${userid}/groups`, 2), { groupid: gid })
|
return api.delete(generateOcsUrl(`cloud/users/${userid}/groups`, 2), { groupid: gid })
|
||||||
.then((response) => context.commit('removeUserGroup', { userid, gid }))
|
.then((response) => context.commit('removeUserGroup', { userid, gid }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
@ -376,7 +377,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
addUserSubAdmin(context, { userid, gid }) {
|
addUserSubAdmin(context, { userid, gid }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/users/${userid}/subadmins`, 2), { groupid: gid })
|
return api.post(generateOcsUrl(`cloud/users/${userid}/subadmins`, 2), { groupid: gid })
|
||||||
.then((response) => context.commit('addUserSubAdmin', { userid, gid }))
|
.then((response) => context.commit('addUserSubAdmin', { userid, gid }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -393,7 +394,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
removeUserSubAdmin(context, { userid, gid }) {
|
removeUserSubAdmin(context, { userid, gid }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.delete(OC.linkToOCS(`cloud/users/${userid}/subadmins`, 2), { groupid: gid })
|
return api.delete(generateOcsUrl(`cloud/users/${userid}/subadmins`, 2), { groupid: gid })
|
||||||
.then((response) => context.commit('removeUserSubAdmin', { userid, gid }))
|
.then((response) => context.commit('removeUserSubAdmin', { userid, gid }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -408,7 +409,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
wipeUserDevices(context, userid) {
|
wipeUserDevices(context, userid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/users/${userid}/wipe`, 2))
|
return api.post(generateOcsUrl(`cloud/users/${userid}/wipe`, 2))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
},
|
},
|
||||||
|
@ -422,7 +423,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
deleteUser(context, userid) {
|
deleteUser(context, userid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.delete(OC.linkToOCS(`cloud/users/${userid}`, 2))
|
return api.delete(generateOcsUrl(`cloud/users/${userid}`, 2))
|
||||||
.then((response) => context.commit('deleteUser', userid))
|
.then((response) => context.commit('deleteUser', userid))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -444,7 +445,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
addUser({ commit, dispatch }, { userid, password, displayName, email, groups, subadmin, quota, language }) {
|
addUser({ commit, dispatch }, { userid, password, displayName, email, groups, subadmin, quota, language }) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/users`, 2), { userid, password, displayName, email, groups, subadmin, quota, language })
|
return api.post(generateOcsUrl(`cloud/users`, 2), { userid, password, displayName, email, groups, subadmin, quota, language })
|
||||||
.then((response) => dispatch('addUserData', userid || response.data.ocs.data.id))
|
.then((response) => dispatch('addUserData', userid || response.data.ocs.data.id))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
@ -462,7 +463,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
addUserData(context, userid) {
|
addUserData(context, userid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.get(OC.linkToOCS(`cloud/users/${userid}`, 2))
|
return api.get(generateOcsUrl(`cloud/users/${userid}`, 2))
|
||||||
.then((response) => context.commit('addUserData', response))
|
.then((response) => context.commit('addUserData', response))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -479,7 +480,7 @@ const actions = {
|
||||||
enableDisableUser(context, { userid, enabled = true }) {
|
enableDisableUser(context, { userid, enabled = true }) {
|
||||||
const userStatus = enabled ? 'enable' : 'disable'
|
const userStatus = enabled ? 'enable' : 'disable'
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.put(OC.linkToOCS(`cloud/users/${userid}/${userStatus}`, 2))
|
return api.put(generateOcsUrl(`cloud/users/${userid}/${userStatus}`, 2))
|
||||||
.then((response) => context.commit('enableDisableUser', { userid, enabled }))
|
.then((response) => context.commit('enableDisableUser', { userid, enabled }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -506,7 +507,7 @@ const actions = {
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.put(OC.linkToOCS(`cloud/users/${userid}`, 2), { key: key, value: value })
|
return api.put(generateOcsUrl(`cloud/users/${userid}`, 2), { key: key, value: value })
|
||||||
.then((response) => context.commit('setUserData', { userid, key, value }))
|
.then((response) => context.commit('setUserData', { userid, key, value }))
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
@ -524,7 +525,7 @@ const actions = {
|
||||||
*/
|
*/
|
||||||
sendWelcomeMail(context, userid) {
|
sendWelcomeMail(context, userid) {
|
||||||
return api.requireAdmin().then((response) => {
|
return api.requireAdmin().then((response) => {
|
||||||
return api.post(OC.linkToOCS(`cloud/users/${userid}/welcome`, 2))
|
return api.post(generateOcsUrl(`cloud/users/${userid}/welcome`, 2))
|
||||||
.then(response => true)
|
.then(response => true)
|
||||||
.catch((error) => { throw error })
|
.catch((error) => { throw error })
|
||||||
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
}).catch((error) => context.commit('API_FAILURE', { userid, error }))
|
||||||
|
|
Loading…
Reference in New Issue