Add 'accounts/' from commit 'd2585070bc25d2c8cd0c86476041ee502afb4ac5'
git-subtree-dir: accounts git-subtree-mainline:7b8e9bc298git-subtree-split:d2585070bc
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'regenerator-runtime/runtime'
|
||||
import App from './components/App.vue'
|
||||
import store from './store'
|
||||
|
||||
const appInfo = {
|
||||
name: 'Accounts',
|
||||
id: 'accounts',
|
||||
icon: 'text-vcard',
|
||||
isFileEditor: false,
|
||||
extensions: []
|
||||
}
|
||||
|
||||
const routes = [
|
||||
{
|
||||
name: 'accounts',
|
||||
path: '/',
|
||||
components: {
|
||||
app: App
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
name: 'Accounts',
|
||||
iconMaterial: appInfo.icon,
|
||||
route: {
|
||||
name: 'accounts',
|
||||
path: `/${appInfo.id}/`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
appInfo,
|
||||
routes,
|
||||
navItems,
|
||||
store
|
||||
}
|
||||
@@ -0,0 +1,723 @@
|
||||
/* eslint-disable */
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
let domain = ''
|
||||
export const getDomain = () => {
|
||||
return domain
|
||||
}
|
||||
export const setDomain = ($domain) => {
|
||||
domain = $domain
|
||||
}
|
||||
export const request = (method, url, body, queryParameters, form, config) => {
|
||||
method = method.toLowerCase()
|
||||
let keys = Object.keys(queryParameters)
|
||||
let queryUrl = url
|
||||
if (keys.length > 0) {
|
||||
queryUrl = url + '?' + qs.stringify(queryParameters)
|
||||
}
|
||||
// let queryUrl = url+(keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
if (body) {
|
||||
return axios[method](queryUrl, body, config)
|
||||
} else if (method === 'get') {
|
||||
return axios[method](queryUrl, config)
|
||||
} else {
|
||||
return axios[method](queryUrl, qs.stringify(form), config)
|
||||
}
|
||||
}
|
||||
/*==========================================================
|
||||
*
|
||||
==========================================================*/
|
||||
/**
|
||||
* Creates an account
|
||||
* request: AccountsService_CreateAccount
|
||||
* url: AccountsService_CreateAccountURL
|
||||
* method: AccountsService_CreateAccount_TYPE
|
||||
* raw_url: AccountsService_CreateAccount_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const AccountsService_CreateAccount = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/accounts/accounts-create'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const AccountsService_CreateAccount_RAW_URL = function() {
|
||||
return '/api/v0/accounts/accounts-create'
|
||||
}
|
||||
export const AccountsService_CreateAccount_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const AccountsService_CreateAccountURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/accounts/accounts-create'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Deletes an account
|
||||
* request: AccountsService_DeleteAccount
|
||||
* url: AccountsService_DeleteAccountURL
|
||||
* method: AccountsService_DeleteAccount_TYPE
|
||||
* raw_url: AccountsService_DeleteAccount_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const AccountsService_DeleteAccount = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/accounts/accounts-delete'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const AccountsService_DeleteAccount_RAW_URL = function() {
|
||||
return '/api/v0/accounts/accounts-delete'
|
||||
}
|
||||
export const AccountsService_DeleteAccount_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const AccountsService_DeleteAccountURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/accounts/accounts-delete'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Gets an account
|
||||
* request: AccountsService_GetAccount
|
||||
* url: AccountsService_GetAccountURL
|
||||
* method: AccountsService_GetAccount_TYPE
|
||||
* raw_url: AccountsService_GetAccount_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const AccountsService_GetAccount = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/accounts/accounts-get'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const AccountsService_GetAccount_RAW_URL = function() {
|
||||
return '/api/v0/accounts/accounts-get'
|
||||
}
|
||||
export const AccountsService_GetAccount_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const AccountsService_GetAccountURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/accounts/accounts-get'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Lists accounts
|
||||
* request: AccountsService_ListAccounts
|
||||
* url: AccountsService_ListAccountsURL
|
||||
* method: AccountsService_ListAccounts_TYPE
|
||||
* raw_url: AccountsService_ListAccounts_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const AccountsService_ListAccounts = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/accounts/accounts-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const AccountsService_ListAccounts_RAW_URL = function() {
|
||||
return '/api/v0/accounts/accounts-list'
|
||||
}
|
||||
export const AccountsService_ListAccounts_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const AccountsService_ListAccountsURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/accounts/accounts-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Updates an account
|
||||
* request: AccountsService_UpdateAccount
|
||||
* url: AccountsService_UpdateAccountURL
|
||||
* method: AccountsService_UpdateAccount_TYPE
|
||||
* raw_url: AccountsService_UpdateAccount_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const AccountsService_UpdateAccount = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/accounts/accounts-update'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const AccountsService_UpdateAccount_RAW_URL = function() {
|
||||
return '/api/v0/accounts/accounts-update'
|
||||
}
|
||||
export const AccountsService_UpdateAccount_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const AccountsService_UpdateAccountURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/accounts/accounts-update'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Lists groups
|
||||
* request: GroupsService_ListGroups
|
||||
* url: GroupsService_ListGroupsURL
|
||||
* method: GroupsService_ListGroups_TYPE
|
||||
* raw_url: GroupsService_ListGroups_RAW_URL
|
||||
* @param pageSize - Optional. The maximum number of groups to return in the response.
|
||||
* @param pageToken - Optional. A pagination token returned from a previous call to `Get`
|
||||
that indicates from where search should continue.
|
||||
* @param fieldMaskPaths - The set of field mask paths.
|
||||
* @param query - Optional. Search criteria used to select the groups to return.
|
||||
If no search criteria is specified then all groups will be
|
||||
returned. TODO update query language
|
||||
Query expressions can be used to restrict results based upon
|
||||
the account properties where the operators `=`, `NOT`, `AND` and `OR`
|
||||
can be used along with the suffix wildcard symbol `*`.
|
||||
|
||||
The string properties in a query expression should use escaped quotes
|
||||
for values that include whitespace to prevent unexpected behavior.
|
||||
|
||||
Some example queries are:
|
||||
|
||||
* Query `display_name=Th*` returns accounts whose display_name
|
||||
starts with "Th"
|
||||
* Query `display_name=\\"Test String\\"` returns groups with
|
||||
display names that include both "Test" and "String"
|
||||
*/
|
||||
export const GroupsService_ListGroups = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['pageSize'] !== undefined) {
|
||||
queryParameters['page_size'] = parameters['pageSize']
|
||||
}
|
||||
if (parameters['pageToken'] !== undefined) {
|
||||
queryParameters['page_token'] = parameters['pageToken']
|
||||
}
|
||||
if (parameters['fieldMaskPaths'] !== undefined) {
|
||||
queryParameters['field_mask.paths'] = parameters['fieldMaskPaths']
|
||||
}
|
||||
if (parameters['query'] !== undefined) {
|
||||
queryParameters['query'] = parameters['query']
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('get', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_ListGroups_RAW_URL = function() {
|
||||
return '/v0/groups'
|
||||
}
|
||||
export const GroupsService_ListGroups_TYPE = function() {
|
||||
return 'get'
|
||||
}
|
||||
export const GroupsService_ListGroupsURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups'
|
||||
if (parameters['pageSize'] !== undefined) {
|
||||
queryParameters['page_size'] = parameters['pageSize']
|
||||
}
|
||||
if (parameters['pageToken'] !== undefined) {
|
||||
queryParameters['page_token'] = parameters['pageToken']
|
||||
}
|
||||
if (parameters['fieldMaskPaths'] !== undefined) {
|
||||
queryParameters['field_mask.paths'] = parameters['fieldMaskPaths']
|
||||
}
|
||||
if (parameters['query'] !== undefined) {
|
||||
queryParameters['query'] = parameters['query']
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Creates a group
|
||||
* request: GroupsService_CreateGroup
|
||||
* url: GroupsService_CreateGroupURL
|
||||
* method: GroupsService_CreateGroup_TYPE
|
||||
* raw_url: GroupsService_CreateGroup_RAW_URL
|
||||
* @param body - The account resource to create
|
||||
*/
|
||||
export const GroupsService_CreateGroup = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_CreateGroup_RAW_URL = function() {
|
||||
return '/v0/groups'
|
||||
}
|
||||
export const GroupsService_CreateGroup_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const GroupsService_CreateGroupURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Updates a group
|
||||
* request: GroupsService_UpdateGroup
|
||||
* url: GroupsService_UpdateGroupURL
|
||||
* method: GroupsService_UpdateGroup_TYPE
|
||||
* raw_url: GroupsService_UpdateGroup_RAW_URL
|
||||
* @param groupId - The unique identifier for the group.
|
||||
Returned by default. Inherited from directoryObject. Key. Not nullable. Read-only.
|
||||
* @param body - The group resource which replaces the resource on the server
|
||||
*/
|
||||
export const GroupsService_UpdateGroup = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{group.id}'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{group.id}', `${parameters['groupId']}`)
|
||||
if (parameters['groupId'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: groupId'))
|
||||
}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('patch', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_UpdateGroup_RAW_URL = function() {
|
||||
return '/v0/groups/{group.id}'
|
||||
}
|
||||
export const GroupsService_UpdateGroup_TYPE = function() {
|
||||
return 'patch'
|
||||
}
|
||||
export const GroupsService_UpdateGroupURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{group.id}'
|
||||
path = path.replace('{group.id}', `${parameters['groupId']}`)
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Gets an groups
|
||||
* request: GroupsService_GetGroup
|
||||
* url: GroupsService_GetGroupURL
|
||||
* method: GroupsService_GetGroup_TYPE
|
||||
* raw_url: GroupsService_GetGroup_RAW_URL
|
||||
* @param id -
|
||||
*/
|
||||
export const GroupsService_GetGroup = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{id}'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['id'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: id'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('get', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_GetGroup_RAW_URL = function() {
|
||||
return '/v0/groups/{id}'
|
||||
}
|
||||
export const GroupsService_GetGroup_TYPE = function() {
|
||||
return 'get'
|
||||
}
|
||||
export const GroupsService_GetGroupURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{id}'
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* Deletes a group
|
||||
* request: GroupsService_DeleteGroup
|
||||
* url: GroupsService_DeleteGroupURL
|
||||
* method: GroupsService_DeleteGroup_TYPE
|
||||
* raw_url: GroupsService_DeleteGroup_RAW_URL
|
||||
* @param id -
|
||||
*/
|
||||
export const GroupsService_DeleteGroup = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{id}'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['id'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: id'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('delete', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_DeleteGroup_RAW_URL = function() {
|
||||
return '/v0/groups/{id}'
|
||||
}
|
||||
export const GroupsService_DeleteGroup_TYPE = function() {
|
||||
return 'delete'
|
||||
}
|
||||
export const GroupsService_DeleteGroupURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{id}'
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* group:listmembers https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0
|
||||
* request: GroupsService_ListMembers
|
||||
* url: GroupsService_ListMembersURL
|
||||
* method: GroupsService_ListMembers_TYPE
|
||||
* raw_url: GroupsService_ListMembers_RAW_URL
|
||||
* @param id - The group id
|
||||
* @param pageSize -
|
||||
* @param pageToken - Optional. A pagination token returned from a previous call to `Get`
|
||||
that indicates from where search should continue.
|
||||
* @param fieldMaskPaths - The set of field mask paths.
|
||||
* @param query - Optional. Search criteria used to select the groups to return.
|
||||
If no search criteria is specified then all groups will be
|
||||
returned. TODO update query language
|
||||
Query expressions can be used to restrict results based upon
|
||||
the account properties where the operators `=`, `NOT`, `AND` and `OR`
|
||||
can be used along with the suffix wildcard symbol `*`.
|
||||
|
||||
The string properties in a query expression should use escaped quotes
|
||||
for values that include whitespace to prevent unexpected behavior.
|
||||
|
||||
Some example queries are:
|
||||
|
||||
* Query `display_name=Th*` returns accounts whose display_name
|
||||
starts with "Th"
|
||||
* Query `display_name=\\"Test String\\"` returns groups with
|
||||
display names that include both "Test" and "String"
|
||||
*/
|
||||
export const GroupsService_ListMembers = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{id}/members/$ref'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['id'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: id'))
|
||||
}
|
||||
if (parameters['pageSize'] !== undefined) {
|
||||
queryParameters['page_size'] = parameters['pageSize']
|
||||
}
|
||||
if (parameters['pageToken'] !== undefined) {
|
||||
queryParameters['page_token'] = parameters['pageToken']
|
||||
}
|
||||
if (parameters['fieldMaskPaths'] !== undefined) {
|
||||
queryParameters['field_mask.paths'] = parameters['fieldMaskPaths']
|
||||
}
|
||||
if (parameters['query'] !== undefined) {
|
||||
queryParameters['query'] = parameters['query']
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('get', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_ListMembers_RAW_URL = function() {
|
||||
return '/v0/groups/{id}/members/$ref'
|
||||
}
|
||||
export const GroupsService_ListMembers_TYPE = function() {
|
||||
return 'get'
|
||||
}
|
||||
export const GroupsService_ListMembersURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{id}/members/$ref'
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['pageSize'] !== undefined) {
|
||||
queryParameters['page_size'] = parameters['pageSize']
|
||||
}
|
||||
if (parameters['pageToken'] !== undefined) {
|
||||
queryParameters['page_token'] = parameters['pageToken']
|
||||
}
|
||||
if (parameters['fieldMaskPaths'] !== undefined) {
|
||||
queryParameters['field_mask.paths'] = parameters['fieldMaskPaths']
|
||||
}
|
||||
if (parameters['query'] !== undefined) {
|
||||
queryParameters['query'] = parameters['query']
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
|
||||
* request: GroupsService_AddMember
|
||||
* url: GroupsService_AddMemberURL
|
||||
* method: GroupsService_AddMember_TYPE
|
||||
* raw_url: GroupsService_AddMember_RAW_URL
|
||||
* @param id - The account id to add
|
||||
* @param body -
|
||||
*/
|
||||
export const GroupsService_AddMember = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{id}/members/$ref'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['id'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: id'))
|
||||
}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_AddMember_RAW_URL = function() {
|
||||
return '/v0/groups/{id}/members/$ref'
|
||||
}
|
||||
export const GroupsService_AddMember_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const GroupsService_AddMemberURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{id}/members/$ref'
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
* group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0
|
||||
* request: GroupsService_RemoveMember
|
||||
* url: GroupsService_RemoveMemberURL
|
||||
* method: GroupsService_RemoveMember_TYPE
|
||||
* raw_url: GroupsService_RemoveMember_RAW_URL
|
||||
* @param id - The group id
|
||||
* @param accountId - The account id to remove
|
||||
*/
|
||||
export const GroupsService_RemoveMember = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/v0/groups/{id}/members/{account_id}/$ref'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
if (parameters['id'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: id'))
|
||||
}
|
||||
path = path.replace('{account_id}', `${parameters['accountId']}`)
|
||||
if (parameters['accountId'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: accountId'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('delete', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const GroupsService_RemoveMember_RAW_URL = function() {
|
||||
return '/v0/groups/{id}/members/{account_id}/$ref'
|
||||
}
|
||||
export const GroupsService_RemoveMember_TYPE = function() {
|
||||
return 'delete'
|
||||
}
|
||||
export const GroupsService_RemoveMemberURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/v0/groups/{id}/members/{account_id}/$ref'
|
||||
path = path.replace('{id}', `${parameters['id']}`)
|
||||
path = path.replace('{account_id}', `${parameters['accountId']}`)
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
@@ -0,0 +1,627 @@
|
||||
/* eslint-disable */
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
let domain = ''
|
||||
export const getDomain = () => {
|
||||
return domain
|
||||
}
|
||||
export const setDomain = ($domain) => {
|
||||
domain = $domain
|
||||
}
|
||||
export const request = (method, url, body, queryParameters, form, config) => {
|
||||
method = method.toLowerCase()
|
||||
let keys = Object.keys(queryParameters)
|
||||
let queryUrl = url
|
||||
if (keys.length > 0) {
|
||||
queryUrl = url + '?' + qs.stringify(queryParameters)
|
||||
}
|
||||
// let queryUrl = url+(keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
if (body) {
|
||||
return axios[method](queryUrl, body, config)
|
||||
} else if (method === 'get') {
|
||||
return axios[method](queryUrl, config)
|
||||
} else {
|
||||
return axios[method](queryUrl, qs.stringify(form), config)
|
||||
}
|
||||
}
|
||||
/*==========================================================
|
||||
*
|
||||
==========================================================*/
|
||||
/**
|
||||
*
|
||||
* request: RoleService_AssignRoleToUser
|
||||
* url: RoleService_AssignRoleToUserURL
|
||||
* method: RoleService_AssignRoleToUser_TYPE
|
||||
* raw_url: RoleService_AssignRoleToUser_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_AssignRoleToUser = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-add'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_AssignRoleToUser_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-add'
|
||||
}
|
||||
export const RoleService_AssignRoleToUser_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_AssignRoleToUserURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-add'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_ListRoleAssignments
|
||||
* url: RoleService_ListRoleAssignmentsURL
|
||||
* method: RoleService_ListRoleAssignments_TYPE
|
||||
* raw_url: RoleService_ListRoleAssignments_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_ListRoleAssignments = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_ListRoleAssignments_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-list'
|
||||
}
|
||||
export const RoleService_ListRoleAssignments_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_ListRoleAssignmentsURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_RemoveRoleFromUser
|
||||
* url: RoleService_RemoveRoleFromUserURL
|
||||
* method: RoleService_RemoveRoleFromUser_TYPE
|
||||
* raw_url: RoleService_RemoveRoleFromUser_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_RemoveRoleFromUser = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-remove'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUser_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-remove'
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUser_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUserURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-remove'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_GetBundle
|
||||
* url: BundleService_GetBundleURL
|
||||
* method: BundleService_GetBundle_TYPE
|
||||
* raw_url: BundleService_GetBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_GetBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundle-get'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_GetBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundle-get'
|
||||
}
|
||||
export const BundleService_GetBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_GetBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundle-get'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_SaveBundle
|
||||
* url: BundleService_SaveBundleURL
|
||||
* method: BundleService_SaveBundle_TYPE
|
||||
* raw_url: BundleService_SaveBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_SaveBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundle-save'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_SaveBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundle-save'
|
||||
}
|
||||
export const BundleService_SaveBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_SaveBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundle-save'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_AddSettingToBundle
|
||||
* url: BundleService_AddSettingToBundleURL
|
||||
* method: BundleService_AddSettingToBundle_TYPE
|
||||
* raw_url: BundleService_AddSettingToBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_AddSettingToBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-add-setting'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_AddSettingToBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-add-setting'
|
||||
}
|
||||
export const BundleService_AddSettingToBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_AddSettingToBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-add-setting'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_ListBundles
|
||||
* url: BundleService_ListBundlesURL
|
||||
* method: BundleService_ListBundles_TYPE
|
||||
* raw_url: BundleService_ListBundles_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_ListBundles = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_ListBundles_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-list'
|
||||
}
|
||||
export const BundleService_ListBundles_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_ListBundlesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_RemoveSettingFromBundle
|
||||
* url: BundleService_RemoveSettingFromBundleURL
|
||||
* method: BundleService_RemoveSettingFromBundle_TYPE
|
||||
* raw_url: BundleService_RemoveSettingFromBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_RemoveSettingFromBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-remove-setting'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-remove-setting'
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-remove-setting'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_ListRoles
|
||||
* url: RoleService_ListRolesURL
|
||||
* method: RoleService_ListRoles_TYPE
|
||||
* raw_url: RoleService_ListRoles_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_ListRoles = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/roles-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_ListRoles_RAW_URL = function() {
|
||||
return '/api/v0/settings/roles-list'
|
||||
}
|
||||
export const RoleService_ListRoles_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_ListRolesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/roles-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_GetValue
|
||||
* url: ValueService_GetValueURL
|
||||
* method: ValueService_GetValue_TYPE
|
||||
* raw_url: ValueService_GetValue_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_GetValue = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-get'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_GetValue_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-get'
|
||||
}
|
||||
export const ValueService_GetValue_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_GetValueURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-get'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_GetValueByUniqueIdentifiers
|
||||
* url: ValueService_GetValueByUniqueIdentifiersURL
|
||||
* method: ValueService_GetValueByUniqueIdentifiers_TYPE
|
||||
* raw_url: ValueService_GetValueByUniqueIdentifiers_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_GetValueByUniqueIdentifiers = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiers_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiers_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiersURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_ListValues
|
||||
* url: ValueService_ListValuesURL
|
||||
* method: ValueService_ListValues_TYPE
|
||||
* raw_url: ValueService_ListValues_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_ListValues = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_ListValues_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-list'
|
||||
}
|
||||
export const ValueService_ListValues_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_ListValuesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_SaveValue
|
||||
* url: ValueService_SaveValueURL
|
||||
* method: ValueService_SaveValue_TYPE
|
||||
* raw_url: ValueService_SaveValue_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_SaveValue = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-save'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_SaveValue_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-save'
|
||||
}
|
||||
export const ValueService_SaveValue_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_SaveValueURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-save'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="uk-flex uk-flex-column" id="accounts-app">
|
||||
<template v-if="isInitialized">
|
||||
<div class="oc-app-bar">
|
||||
<accounts-batch-actions
|
||||
v-if="isAnyAccountSelected"
|
||||
:number-of-selected-accounts="numberOfSelectedAccounts"
|
||||
:selected-accounts="selectedAccounts"
|
||||
/>
|
||||
<accounts-create v-else />
|
||||
</div>
|
||||
<oc-grid class="uk-height-1-1 uk-flex-1 uk-overflow-auto">
|
||||
<div class="uk-width-expand">
|
||||
<accounts-list :accounts="accounts" />
|
||||
</div>
|
||||
</oc-grid>
|
||||
</template>
|
||||
<oc-loader v-else />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions, mapState } from 'vuex'
|
||||
import AccountsList from './accounts/AccountsList.vue'
|
||||
import AccountsCreate from './accounts/AccountsCreate.vue'
|
||||
import AccountsBatchActions from './accounts/AccountsBatchActions.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: { AccountsBatchActions, AccountsList, AccountsCreate },
|
||||
computed: {
|
||||
...mapGetters('Accounts', ['isInitialized', 'getAccountsSorted', 'isAnyAccountSelected']),
|
||||
...mapState('Accounts', ['selectedAccounts']),
|
||||
|
||||
accounts () {
|
||||
return this.getAccountsSorted
|
||||
},
|
||||
numberOfSelectedAccounts () {
|
||||
return this.selectedAccounts.length
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('Accounts', ['initialize'])
|
||||
},
|
||||
created () {
|
||||
this.initialize()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* TODO: After https://github.com/owncloud/owncloud-design-system/pull/418 gets merged
|
||||
there won't be an extra span and this won't be needed anymore */
|
||||
.accounts-selection-actions-btn > span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* TODO: Adjust in ODS */
|
||||
.oc-dropdown-menu {
|
||||
width: 150px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<oc-grid key="selected-accounts-info" gutter="small" class="uk-flex-middle">
|
||||
<span v-text="selectionInfoText" />
|
||||
<span>|</span>
|
||||
<div>
|
||||
<oc-button v-text="$gettext('Clear selection')" variation="raw" @click="RESET_ACCOUNTS_SELECTION" />
|
||||
</div>
|
||||
<oc-grid gutter="small" id="accounts-batch-actions">
|
||||
<div v-for="action in actions" :key="action.label">
|
||||
<oc-alert v-if="isConfirmationInProgress[action.id]" :variation="action.confirmation.variation || 'default'" noClose class="tmp-alert-fixes">
|
||||
<span>{{ action.confirmation.message }}</span>
|
||||
<oc-button size="small" :id="action.confirmation.cancel.id" @click="action.confirmation.cancel.handler" :variation="action.confirmation.cancel.variation || 'default'">
|
||||
{{ action.confirmation.cancel.label }}
|
||||
</oc-button>
|
||||
<oc-button size="small" :id="action.confirmation.confirm.id" @click="action.confirmation.confirm.handler" :variation="action.confirmation.confirm.variation || 'default'">
|
||||
{{ action.confirmation.confirm.label }}
|
||||
</oc-button>
|
||||
</oc-alert>
|
||||
<oc-button v-else :id="action.id" @click="action.handler" :variation="action.variation || 'default'" :icon="action.icon">
|
||||
{{ action.label }}
|
||||
</oc-button>
|
||||
</div>
|
||||
</oc-grid>
|
||||
</oc-grid>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapMutations } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AccountsBatchActions',
|
||||
props: {
|
||||
numberOfSelectedAccounts: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
selectedAccounts: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
isConfirmationInProgress: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selectionInfoText () {
|
||||
const translated = this.$ngettext('%{ amount } selected user', '%{ amount } selected users', this.numberOfSelectedAccounts)
|
||||
return this.$gettextInterpolate(translated, { amount: this.numberOfSelectedAccounts })
|
||||
},
|
||||
actions () {
|
||||
const actions = []
|
||||
const numberOfDisabledAccounts = this.selectedAccounts.filter(account => !account.accountEnabled).length
|
||||
const isAnyAccountDisabled = numberOfDisabledAccounts > 0
|
||||
const isAnyAccountEnabled = numberOfDisabledAccounts < this.numberOfSelectedAccounts
|
||||
|
||||
if (isAnyAccountDisabled) {
|
||||
actions.push({
|
||||
id: 'accounts-batch-action-enable',
|
||||
label: this.$gettext('Activate'),
|
||||
icon: 'ready',
|
||||
handler: () => this.setAccountActivated(true)
|
||||
})
|
||||
}
|
||||
|
||||
if (isAnyAccountEnabled) {
|
||||
actions.push({
|
||||
id: 'accounts-batch-action-disable',
|
||||
label: this.$gettext('Block'),
|
||||
icon: 'deprecated',
|
||||
handler: () => this.setAccountActivated(false)
|
||||
})
|
||||
}
|
||||
|
||||
const idDeleteAction = 'accounts-batch-action-delete'
|
||||
actions.push({
|
||||
id: idDeleteAction,
|
||||
label: this.$gettext('Delete'),
|
||||
icon: 'delete',
|
||||
handler: () => this.showConfirmationRequest(idDeleteAction),
|
||||
confirmation: {
|
||||
variation: 'danger',
|
||||
message: this.$ngettext(
|
||||
'Delete the selected account?',
|
||||
'Delete the selected accounts?',
|
||||
this.numberOfSelectedAccounts
|
||||
),
|
||||
cancel: {
|
||||
id: 'accounts-batch-action-delete-cancel',
|
||||
label: this.$gettext('Cancel'),
|
||||
variation: 'secondary',
|
||||
handler: () => this.hideConfirmationRequest(idDeleteAction)
|
||||
},
|
||||
confirm: {
|
||||
id: 'accounts-batch-action-delete-confirm',
|
||||
label: this.$gettext('Confirm'),
|
||||
variation: 'danger',
|
||||
handler: this.deleteAccounts
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return actions
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('Accounts', ['setAccountActivated', 'deleteAccounts']),
|
||||
...mapMutations('Accounts', ['RESET_ACCOUNTS_SELECTION']),
|
||||
showConfirmationRequest (actionId) {
|
||||
this.isConfirmationInProgress = { ...this.isConfirmationInProgress, [actionId]: true }
|
||||
},
|
||||
hideConfirmationRequest (actionId) {
|
||||
this.isConfirmationInProgress = { ...this.isConfirmationInProgress, [actionId]: false }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tmp-alert-fixes {
|
||||
padding: 5px 10px 4px !important;
|
||||
border-radius: 3px !important;
|
||||
background-color: #fff !important;
|
||||
border: 1px solid rgb(224, 0, 0) !important;
|
||||
color: rgb(224, 0, 0) !important;
|
||||
|
||||
font-size: 1.125rem !important;
|
||||
font-weight: 600 !important;
|
||||
line-height: 1.4 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<div>
|
||||
<oc-grid v-if="isFormInProgress" gutter="small">
|
||||
<label>
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-username"
|
||||
type="text"
|
||||
v-model="formData.username"
|
||||
:error-message="formValidation.usernameError"
|
||||
:placeholder="$gettext('Username')"
|
||||
:disabled="isRequestInProgress"
|
||||
@keydown.enter="createAccount"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-email"
|
||||
type="email"
|
||||
v-model="formData.email"
|
||||
:error-message="formValidation.emailError"
|
||||
:placeholder="$gettext('Email')"
|
||||
:disabled="isRequestInProgress"
|
||||
@keydown.enter="createAccount"
|
||||
/>
|
||||
</label>
|
||||
<label class="uk-margin-xsmall-right">
|
||||
<oc-text-input
|
||||
id="accounts-new-account-input-password"
|
||||
type="password"
|
||||
v-model="formData.password"
|
||||
:error-message="formValidation.passwordError"
|
||||
:placeholder="$gettext('Password')"
|
||||
:disabled="isRequestInProgress"
|
||||
@keydown.enter="createAccount"
|
||||
/>
|
||||
</label>
|
||||
<div>
|
||||
<oc-button
|
||||
v-text="$gettext('Cancel')"
|
||||
@click="cancelForm"
|
||||
class="uk-margin-xsmall-right"
|
||||
:disabled="isRequestInProgress"
|
||||
/>
|
||||
<oc-button
|
||||
id="accounts-new-account-button-confirm"
|
||||
variation="primary"
|
||||
:disabled="isRequestInProgress"
|
||||
@click="createAccount"
|
||||
>
|
||||
<oc-spinner
|
||||
v-if="isRequestInProgress"
|
||||
key="account-creation-in-progress"
|
||||
size="xsmall"
|
||||
class="uk-margin-xsmall-right"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span v-text="isRequestInProgress ? $gettext('Creating') : $gettext('Create')" />
|
||||
</oc-button>
|
||||
</div>
|
||||
</oc-grid>
|
||||
<oc-grid v-else gutter="small">
|
||||
<div>
|
||||
<oc-button
|
||||
id="accounts-new-account-trigger"
|
||||
key="create-accounts-button"
|
||||
icon="add"
|
||||
variation="primary"
|
||||
@click="setFormInProgress(true)"
|
||||
>
|
||||
<translate>Create new account</translate>
|
||||
</oc-button>
|
||||
</div>
|
||||
</oc-grid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isEmail from 'validator/es/lib/isEmail'
|
||||
import isEmpty from 'validator/es/lib/isEmpty'
|
||||
import debounce from 'debounce'
|
||||
import { mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AccountsCreate',
|
||||
|
||||
data: () => ({
|
||||
isFormInProgress: false,
|
||||
isRequestInProgress: false,
|
||||
formData: {
|
||||
username: '',
|
||||
email: '',
|
||||
password: ''
|
||||
},
|
||||
formValidation: {
|
||||
usernameError: '',
|
||||
emailError: '',
|
||||
passwordError: ''
|
||||
}
|
||||
}),
|
||||
|
||||
methods: {
|
||||
...mapActions('Accounts', ['createNewAccount']),
|
||||
|
||||
setFormInProgress (inProgress) {
|
||||
this.isFormInProgress = inProgress
|
||||
},
|
||||
|
||||
cancelForm () {
|
||||
this.isRequestInProgress = false
|
||||
this.setFormInProgress(false)
|
||||
this.formData = {
|
||||
username: '',
|
||||
email: '',
|
||||
password: ''
|
||||
}
|
||||
this.formValidation = {
|
||||
usernameError: '',
|
||||
emailError: '',
|
||||
passwordError: ''
|
||||
}
|
||||
},
|
||||
|
||||
createAccount () {
|
||||
// note: use bitwise AND because we want all checks to be performed
|
||||
if (!(this.checkUsername() & this.checkEmail() & this.checkPassword())) {
|
||||
return
|
||||
}
|
||||
|
||||
this.isRequestInProgress = true
|
||||
this.createNewAccount(this.formData)
|
||||
.then((success) => {
|
||||
if (success) {
|
||||
this.cancelForm()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.isRequestInProgress = false
|
||||
})
|
||||
},
|
||||
|
||||
checkUsername () {
|
||||
if (isEmpty(this.formData.username)) {
|
||||
debounce(this.formValidation.usernameError = this.$gettext('Username cannot be empty'), 500)
|
||||
return false
|
||||
}
|
||||
// hacky check: we want to allow emails and the username part of emails as username
|
||||
if (!isEmail(this.formData.username) && !isEmail(this.formData.username + '@validate.it')) {
|
||||
debounce(this.formValidation.usernameError = this.$gettext('Invalid username'), 500)
|
||||
return false
|
||||
}
|
||||
|
||||
this.formValidation.usernameError = ''
|
||||
return true
|
||||
},
|
||||
|
||||
checkEmail () {
|
||||
if (isEmpty(this.formData.email)) {
|
||||
debounce(this.formValidation.emailError = this.$gettext('Email cannot be empty'), 500)
|
||||
return false
|
||||
}
|
||||
|
||||
if (!isEmail(this.formData.email)) {
|
||||
debounce(this.formValidation.emailError = this.$gettext('Invalid email address'), 500)
|
||||
return false
|
||||
}
|
||||
|
||||
this.formValidation.emailError = ''
|
||||
return true
|
||||
},
|
||||
|
||||
checkPassword () {
|
||||
// Later on some restrictions might be applied here
|
||||
if (isEmpty(this.formData.password)) {
|
||||
debounce(this.formValidation.passwordError = this.$gettext('Password cannot be empty'), 500)
|
||||
return false
|
||||
}
|
||||
|
||||
this.formValidation.passwordError = ''
|
||||
return true
|
||||
}
|
||||
},
|
||||
onDestroy () {
|
||||
this.cancelForm()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#accounts-new-account-button-confirm > span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div>
|
||||
<oc-table middle divider>
|
||||
<oc-table-group>
|
||||
<oc-table-row>
|
||||
<oc-table-cell shrink type="head">
|
||||
<oc-checkbox
|
||||
:value="areAllAccountsSelected"
|
||||
:label="$gettext('Select all users')"
|
||||
hide-label
|
||||
@change="toggleSelectionAll"
|
||||
/>
|
||||
</oc-table-cell>
|
||||
<oc-table-cell shrink type="head" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Username')" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Display name')" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Email')" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Role')" />
|
||||
<oc-table-cell shrink type="head" v-text="$gettext('Activated')" />
|
||||
</oc-table-row>
|
||||
</oc-table-group>
|
||||
<oc-table-group>
|
||||
<accounts-list-row
|
||||
v-for="account in accounts"
|
||||
:key="`account-list-row-${account.id}`"
|
||||
:account="account"
|
||||
/>
|
||||
</oc-table-group>
|
||||
</oc-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters, mapMutations } from 'vuex'
|
||||
import AccountsListRow from './AccountsListRow.vue'
|
||||
|
||||
export default {
|
||||
name: 'AccountsList',
|
||||
components: {
|
||||
AccountsListRow
|
||||
},
|
||||
props: {
|
||||
accounts: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('Accounts', ['areAllAccountsSelected'])
|
||||
},
|
||||
methods: {
|
||||
...mapActions('Accounts', ['toggleSelectionAll']),
|
||||
...mapMutations('Accounts', ['RESET_ACCOUNTS_SELECTION'])
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.RESET_ACCOUNTS_SELECTION()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<oc-table-row>
|
||||
<oc-table-cell>
|
||||
<oc-checkbox :value="isAccountSelected" @change="TOGGLE_SELECTION_ACCOUNT(account)" :label="selectAccountLabel" hide-label />
|
||||
</oc-table-cell>
|
||||
<oc-table-cell>
|
||||
<avatar :user-name="account.displayName || account.onPremisesSamAccountName" :userid="account.id" :width="35" />
|
||||
</oc-table-cell>
|
||||
<oc-table-cell v-text="account.onPremisesSamAccountName" />
|
||||
<oc-table-cell v-text="account.displayName || '-'" />
|
||||
<oc-table-cell v-text="account.mail" />
|
||||
<oc-table-cell>
|
||||
<oc-button :id="`accounts-roles-select-trigger-${account.id}`" class="accounts-roles-select-trigger" variation="raw">
|
||||
<span class="uk-flex uk-flex-middle accounts-roles-current-role">
|
||||
{{ currentRole ? currentRole.displayName : $gettext('Select role') }}
|
||||
<oc-icon name="expand_more" aria-hidden="true" />
|
||||
</span>
|
||||
</oc-button>
|
||||
<oc-drop
|
||||
:drop-id="`accounts-roles-select-dropdown-${account.id}`"
|
||||
:toggle="`#accounts-roles-select-trigger-${account.id}`"
|
||||
mode="click"
|
||||
close-on-click
|
||||
:options="{ delayHide: 0 }"
|
||||
>
|
||||
<ul class="uk-list">
|
||||
<li v-for="role in roles" :key="role.id">
|
||||
<label class="accounts-roles-dropdown-role">
|
||||
<input
|
||||
type="radio"
|
||||
class="oc-radiobutton"
|
||||
v-model="currentRole"
|
||||
:value="role"
|
||||
@change="changeRole(role.id)"
|
||||
/>
|
||||
{{ role.displayName }}
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</oc-drop>
|
||||
</oc-table-cell>
|
||||
<oc-table-cell class="uk-text-center">
|
||||
<oc-icon
|
||||
v-if="account.accountEnabled"
|
||||
key="account-icon-enabled"
|
||||
name="ready"
|
||||
variation="success"
|
||||
:aria-label="$gettext('Account is activated')"
|
||||
class="accounts-status-indicator-enabled"
|
||||
/>
|
||||
<oc-icon
|
||||
v-else
|
||||
name="deprecated"
|
||||
key="account-icon-disabled"
|
||||
variation="danger"
|
||||
:aria-label="$gettext('Account is blocked')"
|
||||
class="accounts-status-indicator-disabled"
|
||||
/>
|
||||
</oc-table-cell>
|
||||
</oc-table-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapState, mapActions, mapMutations } from 'vuex'
|
||||
import { isObjectEmpty } from '../../helpers/utils'
|
||||
import { injectAuthToken } from '../../helpers/auth'
|
||||
// eslint-disable-next-line camelcase
|
||||
import { RoleService_AssignRoleToUser, RoleService_ListRoleAssignments } from '../../client/settings'
|
||||
import Avatar from './Avatar.vue'
|
||||
|
||||
export default {
|
||||
name: 'AccountsListRow',
|
||||
|
||||
components: { Avatar },
|
||||
|
||||
props: {
|
||||
account: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
currentRole: null
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(['user', 'configuration']),
|
||||
...mapState('Accounts', ['roles', 'selectedAccounts']),
|
||||
|
||||
isAccountSelected () {
|
||||
return this.selectedAccounts.indexOf(this.account) > -1
|
||||
},
|
||||
|
||||
selectAccountLabel () {
|
||||
const translated = this.$gettext('Select %{ account }')
|
||||
|
||||
return this.$gettextInterpolate(translated, { account: this.account.displayName }, true)
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getUsersCurrentRole()
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions(['showMessage']),
|
||||
...mapMutations('Accounts', ['TOGGLE_SELECTION_ACCOUNT']),
|
||||
|
||||
async changeRole (roleId) {
|
||||
injectAuthToken(this.user.token)
|
||||
|
||||
const response = await RoleService_AssignRoleToUser({
|
||||
$domain: this.configuration.server,
|
||||
body: {
|
||||
account_uuid: this.account.id,
|
||||
role_id: roleId
|
||||
}
|
||||
})
|
||||
|
||||
if (response.status === 201) {
|
||||
const roleId = response.data.assignment.roleId
|
||||
this.currentRole = this.roles.find(role => {
|
||||
return role.id === roleId
|
||||
})
|
||||
} else {
|
||||
this.showMessage({
|
||||
title: this.$gettext('Failed to change role.'),
|
||||
desc: response.statusText,
|
||||
status: 'danger'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async getUsersCurrentRole () {
|
||||
injectAuthToken(this.user.token)
|
||||
|
||||
const response = await RoleService_ListRoleAssignments({
|
||||
$domain: this.configuration.server,
|
||||
body: {
|
||||
account_uuid: this.account.id
|
||||
}
|
||||
})
|
||||
|
||||
if (response.status === 201) {
|
||||
const assignedRole = response.data
|
||||
|
||||
if (isObjectEmpty(assignedRole)) {
|
||||
return
|
||||
}
|
||||
|
||||
this.currentRole = this.roles.find(role => {
|
||||
return role.id === assignedRole.assignments[0].roleId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<component :is="type" v-if="enabled">
|
||||
<oc-spinner
|
||||
v-if="loading"
|
||||
key="avatar-loading"
|
||||
size="small"
|
||||
:aria-label="$gettext('Loading')"
|
||||
:style="`width: ${width}px; height: ${width}px;`"
|
||||
/>
|
||||
<oc-avatar
|
||||
v-else
|
||||
key="avatar-loaded"
|
||||
:width="width"
|
||||
:src="avatarSource"
|
||||
:user-name="userName"
|
||||
/>
|
||||
</component>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* FIXME: this component has been copied over from phoenix. It should be moved over to ODS, then we can reuse it in
|
||||
* this extension.
|
||||
*/
|
||||
name: 'Avatar',
|
||||
props: {
|
||||
/**
|
||||
* The html element used for the avatar container.
|
||||
* `div, span`
|
||||
*/
|
||||
type: {
|
||||
type: String,
|
||||
default: 'div',
|
||||
validator: value => {
|
||||
return value.match(/(div|span)/)
|
||||
}
|
||||
},
|
||||
userName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
userid: {
|
||||
/**
|
||||
* Allow empty string to show placeholder
|
||||
*/
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 42
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
/**
|
||||
* Set to object URL when loaded, or on failure, icon placeholder is shown
|
||||
*/
|
||||
avatarSource: '',
|
||||
/**
|
||||
* Shows spinner in place whilst loading avatar from server
|
||||
*/
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['getToken']),
|
||||
enabled: function () {
|
||||
return this.$root.config.enableAvatars || true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
userid: function (userid, old) {
|
||||
this.setUser(userid)
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
// Handled mounted situation. Userid might not be set yet so try placeholder
|
||||
if (this.userid !== '') {
|
||||
this.setUser(this.userid)
|
||||
} else {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Load a new avatar from this userid
|
||||
*/
|
||||
setUser (userid) {
|
||||
this.loading = true
|
||||
this.avatarSource = ''
|
||||
if (!this.enabled || userid === '') {
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
const headers = new Headers()
|
||||
const instance = this.$root.config.server || window.location.origin
|
||||
const url = instance + '/remote.php/dav/avatars/' + this.userid + '/128.png'
|
||||
headers.append('Authorization', 'Bearer ' + this.getToken)
|
||||
headers.append('X-Requested-With', 'XMLHttpRequest')
|
||||
fetch(url, { headers })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.blob()
|
||||
}
|
||||
if (response.status !== 404) {
|
||||
throw new Error(`Unexpected status code ${response.status}`)
|
||||
}
|
||||
})
|
||||
.then(blob => {
|
||||
this.loading = false
|
||||
if (blob) {
|
||||
this.avatarSource = window.URL.createObjectURL(blob)
|
||||
} else {
|
||||
// 404, none found
|
||||
this.avatarSource = ''
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.avatarSource = ''
|
||||
this.loading = false
|
||||
console.error(`Error loading avatar image for user "${this.userid}": `, error.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
import axios from 'axios'
|
||||
|
||||
export function injectAuthToken (token) {
|
||||
axios.interceptors.request.use(config => {
|
||||
if (typeof config.headers.Authorization === 'undefined') {
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
return config
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Asserts wheter the given object is empty
|
||||
* @param {Object} obj Object to be checked
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function isObjectEmpty (obj) {
|
||||
return Object.keys(obj).length === 0 && obj.constructor === Object
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
/* eslint-disable camelcase */
|
||||
import {
|
||||
AccountsService_ListAccounts,
|
||||
AccountsService_UpdateAccount,
|
||||
AccountsService_CreateAccount,
|
||||
AccountsService_DeleteAccount
|
||||
} from '../client/accounts'
|
||||
import { RoleService_ListRoles } from '../client/settings'
|
||||
/* eslint-enable camelcase */
|
||||
import { injectAuthToken } from '../helpers/auth'
|
||||
|
||||
const state = {
|
||||
config: null,
|
||||
initialized: false,
|
||||
accounts: {},
|
||||
roles: null,
|
||||
selectedAccounts: []
|
||||
}
|
||||
|
||||
const getters = {
|
||||
config: state => state.config,
|
||||
isInitialized: state => state.initialized,
|
||||
getAccountsSorted: state => {
|
||||
return Object.values(state.accounts).sort((a1, a2) => {
|
||||
if (a1.onPremisesSamAccountName === a2.onPremisesSamAccountName) {
|
||||
return a1.id.localeCompare(a2.id)
|
||||
}
|
||||
return a1.onPremisesSamAccountName.localeCompare(a2.onPremisesSamAccountName)
|
||||
})
|
||||
},
|
||||
areAllAccountsSelected: state => state.accounts.length === state.selectedAccounts.length,
|
||||
isAnyAccountSelected: state => state.selectedAccounts.length > 0
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
LOAD_CONFIG (state, config) {
|
||||
state.config = config
|
||||
},
|
||||
SET_INITIALIZED (state, value) {
|
||||
state.initialized = value
|
||||
},
|
||||
SET_ACCOUNTS (state, accounts) {
|
||||
state.accounts = accounts
|
||||
},
|
||||
SET_ROLES (state, roles) {
|
||||
state.roles = roles
|
||||
},
|
||||
TOGGLE_SELECTION_ACCOUNT (state, account) {
|
||||
const accountIndex = state.selectedAccounts.indexOf(account)
|
||||
|
||||
accountIndex > -1 ? state.selectedAccounts.splice(accountIndex, 1) : state.selectedAccounts.push(account)
|
||||
},
|
||||
SET_SELECTED_ACCOUNTS (state, accounts) {
|
||||
state.selectedAccounts = accounts
|
||||
},
|
||||
|
||||
UPDATE_ACCOUNT (state, updatedAccount) {
|
||||
const accountIndex = state.accounts.findIndex(account => account.id === updatedAccount.id)
|
||||
|
||||
state.accounts.splice(accountIndex, 1, updatedAccount)
|
||||
},
|
||||
|
||||
RESET_ACCOUNTS_SELECTION (state) {
|
||||
state.selectedAccounts = []
|
||||
},
|
||||
|
||||
PUSH_NEW_ACCOUNT (state, account) {
|
||||
state.accounts.push(account)
|
||||
},
|
||||
|
||||
DELETE_ACCOUNT (state, accountId) {
|
||||
const accountIndex = state.accounts.findIndex(account => account.id === accountId)
|
||||
|
||||
state.accounts.splice(accountIndex, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
loadConfig ({ commit }, config) {
|
||||
commit('LOAD_CONFIG', config)
|
||||
},
|
||||
|
||||
async initialize ({ commit, dispatch }) {
|
||||
await dispatch('fetchAccounts')
|
||||
await dispatch('fetchRoles')
|
||||
commit('SET_INITIALIZED', true)
|
||||
},
|
||||
|
||||
async fetchAccounts ({ commit, dispatch, rootGetters }) {
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
const response = await AccountsService_ListAccounts({
|
||||
$domain: rootGetters.configuration.server,
|
||||
body: {}
|
||||
})
|
||||
if (response.status === 201) {
|
||||
const accounts = response.data.accounts
|
||||
commit('SET_ACCOUNTS', accounts || [])
|
||||
} else {
|
||||
dispatch('showMessage', {
|
||||
title: 'Failed to fetch accounts.',
|
||||
desc: response.statusText,
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
}
|
||||
},
|
||||
|
||||
async fetchRoles ({ commit, dispatch, rootGetters }) {
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
|
||||
const response = await RoleService_ListRoles({
|
||||
$domain: rootGetters.configuration.server,
|
||||
body: {}
|
||||
})
|
||||
|
||||
if (response.status === 201) {
|
||||
const roles = response.data.bundles
|
||||
|
||||
commit('SET_ROLES', roles || [])
|
||||
} else {
|
||||
dispatch('showMessage', {
|
||||
title: 'Failed to fetch roles.',
|
||||
desc: response.statusText,
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
}
|
||||
},
|
||||
|
||||
toggleSelectionAll ({ commit, getters, state }) {
|
||||
getters.areAllAccountsSelected ? commit('RESET_ACCOUNTS_SELECTION') : commit('SET_SELECTED_ACCOUNTS', [...state.accounts])
|
||||
},
|
||||
|
||||
async setAccountActivated ({ commit, dispatch, state, rootGetters }, activated) {
|
||||
const failedAccounts = []
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
|
||||
for (const account of state.selectedAccounts) {
|
||||
if (account.accountEnabled === activated) {
|
||||
continue
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await AccountsService_UpdateAccount({
|
||||
$domain: rootGetters.configuration.server,
|
||||
body: {
|
||||
account: {
|
||||
id: account.id,
|
||||
accountEnabled: activated
|
||||
},
|
||||
update_mask: {
|
||||
paths: ['AccountEnabled']
|
||||
}
|
||||
}
|
||||
})
|
||||
if (response.status === 201) {
|
||||
commit('UPDATE_ACCOUNT', { ...account, accountEnabled: activated })
|
||||
} else {
|
||||
failedAccounts.push({ account: account.username })
|
||||
}
|
||||
} catch (error) {
|
||||
failedAccounts.push({ account: account.username })
|
||||
}
|
||||
}
|
||||
|
||||
if (failedAccounts.length > 0) {
|
||||
let errorTitle = ''
|
||||
if (failedAccounts.length === 1) {
|
||||
errorTitle = activated ? 'Failed to activate account.' : 'Failed to block account.'
|
||||
} else {
|
||||
errorTitle = activated ? 'Failed to activate accounts.' : 'Failed to block accounts.'
|
||||
}
|
||||
dispatch('showMessage', {
|
||||
title: errorTitle,
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
|
||||
commit('RESET_ACCOUNTS_SELECTION')
|
||||
return Promise.resolve(true)
|
||||
},
|
||||
async createNewAccount ({ rootGetters, commit, dispatch }, account) {
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
|
||||
try {
|
||||
const response = await AccountsService_CreateAccount({
|
||||
$domain: rootGetters.configuration.server,
|
||||
body: {
|
||||
account: {
|
||||
on_premises_sam_account_name: account.username,
|
||||
preferred_name: account.username,
|
||||
mail: account.email,
|
||||
password_profile: {
|
||||
password: account.password
|
||||
},
|
||||
account_enabled: true,
|
||||
display_name: account.username
|
||||
}
|
||||
}
|
||||
})
|
||||
if (response.status === 201) {
|
||||
commit('PUSH_NEW_ACCOUNT', response.data)
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
} catch (error) {
|
||||
dispatch('showMessage', {
|
||||
title: 'Failed to create account.',
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
return Promise.reject(error)
|
||||
}
|
||||
return Promise.resolve(false)
|
||||
},
|
||||
|
||||
async deleteAccounts ({ rootGetters, state, commit, dispatch }) {
|
||||
const failedAccounts = []
|
||||
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
|
||||
for (const account of state.selectedAccounts) {
|
||||
try {
|
||||
const response = await AccountsService_DeleteAccount({
|
||||
$domain: rootGetters.configuration.server,
|
||||
body: {
|
||||
id: account.id
|
||||
}
|
||||
})
|
||||
if (response.status === 201 || response.status === 204) {
|
||||
commit('DELETE_ACCOUNT', account.id)
|
||||
} else {
|
||||
failedAccounts.push({ account: account.username })
|
||||
}
|
||||
} catch (error) {
|
||||
failedAccounts.push({ account: account.username })
|
||||
}
|
||||
}
|
||||
|
||||
if (failedAccounts.length > 0) {
|
||||
const errorTitle = failedAccounts.length === 1 ? 'Failed to delete account.' : 'Failed to delete accounts.'
|
||||
dispatch('showMessage', {
|
||||
title: errorTitle,
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
|
||||
commit('RESET_ACCOUNTS_SELECTION')
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
Feature: Accounts
|
||||
|
||||
Scenario: admin checks accounts list
|
||||
Given user "Moss" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then user "einstein" should be displayed in the accounts list on the WebUI
|
||||
And user "konnectd" should be displayed in the accounts list on the WebUI
|
||||
And user "marie" should be displayed in the accounts list on the WebUI
|
||||
And user "reva" should be displayed in the accounts list on the WebUI
|
||||
And user "richard" should be displayed in the accounts list on the WebUI
|
||||
|
||||
Scenario: admin changes non-admin user's role to admin
|
||||
Given user "Moss" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then user "einstein" should be displayed in the accounts list on the WebUI
|
||||
When the user changes the role of user "einstein" to "Admin" using the WebUI
|
||||
Then the displayed role of user "einstein" should be "Admin" on the WebUI
|
||||
When the user reloads the current page of the webUI
|
||||
Then the displayed role of user "einstein" should be "Admin" on the WebUI
|
||||
|
||||
Scenario: regular user should not be able to see accounts list
|
||||
Given user "Marie" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then the user should not be able to see the accounts list on the WebUI
|
||||
|
||||
Scenario: guest user should not be able to see accounts list
|
||||
Given user "Moss" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then user "einstein" should be displayed in the accounts list on the WebUI
|
||||
When the user changes the role of user "einstein" to "Guest" using the WebUI
|
||||
And the user logs out of the webUI
|
||||
And user "Einstein" logs in using the webUI
|
||||
And the user browses to the accounts page
|
||||
Then the user should not be able to see the accounts list on the WebUI
|
||||
|
||||
# We want to separate this into own scenarios but because we do not have clean env for each scenario yet
|
||||
# we are resetting it manually by combining them into one
|
||||
Scenario: disable/enable account
|
||||
Given user "Moss" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then user "einstein" should be displayed in the accounts list on the WebUI
|
||||
When the user disables user "einstein" using the WebUI
|
||||
Then the status indicator of user "einstein" should be "disabled" on the WebUI
|
||||
# And user "einstein" should not be able to log in
|
||||
When the user enables user "einstein" using the WebUI
|
||||
Then the status indicator of user "einstein" should be "enabled" on the WebUI
|
||||
# And user "einstein" should be able to log in
|
||||
|
||||
Scenario: disable/enable multiple accounts
|
||||
Given user "Moss" has logged in using the webUI
|
||||
When the user browses to the accounts page
|
||||
Then user "einstein" should be displayed in the accounts list on the WebUI
|
||||
And user "marie" should be displayed in the accounts list on the WebUI
|
||||
When the user disables users "einstein,marie" using the WebUI
|
||||
Then the status indicator of users "einstein,marie" should be "disabled" on the WebUI
|
||||
# And user "einstein" should not be able to log in
|
||||
# And user "marie" should not be able to log in
|
||||
When the user enables users "einstein,marie" using the WebUI
|
||||
Then the status indicator of user "einstein,marie" should be "enabled" on the WebUI
|
||||
# And user "einstein" should be able to log in
|
||||
# And user "marie" should be able to log in
|
||||
|
||||
Scenario: create a user
|
||||
Given user "Moss" has logged in using the webUI
|
||||
And the user browses to the accounts page
|
||||
When the user creates a new user with username "bob", email "bob@example.org" and password "bob" using the WebUI
|
||||
Then user "bob" should be displayed in the accounts list on the WebUI
|
||||
|
||||
Scenario: delete a user
|
||||
Given user "Moss" has logged in using the webUI
|
||||
And the user browses to the accounts page
|
||||
When the user deletes user "bob" using the WebUI
|
||||
Then user "bob" should not be displayed in the accounts list on the WebUI
|
||||
@@ -0,0 +1,170 @@
|
||||
const util = require('util')
|
||||
|
||||
module.exports = {
|
||||
url: function () {
|
||||
return this.api.launchUrl + '/#/accounts'
|
||||
},
|
||||
|
||||
commands: {
|
||||
navigateAndWaitUntilMounted: async function () {
|
||||
const url = this.url()
|
||||
return this.navigate(url).waitForElementVisible('@accountsApp')
|
||||
},
|
||||
accountsList: function () {
|
||||
return this.waitForElementVisible('@accountsListTable')
|
||||
},
|
||||
isUserListed: async function (username) {
|
||||
const usernameInTable = util.format(this.elements.userInAccountsList.selector, username)
|
||||
await this.useXpath().waitForElementVisible(usernameInTable)
|
||||
return true
|
||||
},
|
||||
isUserDeleted: async function (username) {
|
||||
const usernameInTable = util.format(this.elements.userInAccountsList.selector, username)
|
||||
await this.useXpath().waitForElementNotPresent(usernameInTable)
|
||||
return true
|
||||
},
|
||||
|
||||
selectRole: function (username, role) {
|
||||
const roleSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
util.format(this.elements.roleInRolesDropdown.selector, role)
|
||||
|
||||
return this
|
||||
.initAjaxCounters()
|
||||
.waitForElementVisible('@rolesDropdownTrigger')
|
||||
.click('@rolesDropdownTrigger')
|
||||
.waitForElementVisible(roleSelector)
|
||||
.click(roleSelector)
|
||||
.waitForOutstandingAjaxCalls()
|
||||
},
|
||||
|
||||
checkUsersRole: function (username, role) {
|
||||
const roleSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
util.format(this.elements.currentRole.selector, role)
|
||||
|
||||
return this.useXpath().expect.element(roleSelector).to.be.visible
|
||||
},
|
||||
|
||||
setUserActivated: function (usernames, activated) {
|
||||
this.selectUsers(usernames)
|
||||
return this.click(activated === true ? this.elements.batchActionEnable : this.elements.batchActionDisable)
|
||||
},
|
||||
|
||||
checkUsersStatus: function (usernames, status) {
|
||||
usernames = usernames.split(',')
|
||||
|
||||
for (const username of usernames) {
|
||||
const indicatorSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
util.format(this.elements.statusIndicator.selector, status)
|
||||
|
||||
this.useXpath().waitForElementVisible(indicatorSelector)
|
||||
}
|
||||
|
||||
return this
|
||||
},
|
||||
|
||||
deleteUsers: function (usernames) {
|
||||
this.selectUsers(usernames)
|
||||
return this.click(this.elements.batchActionDelete)
|
||||
.waitForElementVisible(this.elements.batchActionDeleteConfirm)
|
||||
.click(this.elements.batchActionDeleteConfirm)
|
||||
},
|
||||
|
||||
selectUsers: function (usernames) {
|
||||
usernames = usernames.split(',')
|
||||
|
||||
for (const username of usernames) {
|
||||
const checkboxSelector =
|
||||
util.format(this.elements.rowByUsername.selector, username) +
|
||||
this.elements.rowCheckbox.selector
|
||||
|
||||
this.useXpath().click(checkboxSelector)
|
||||
}
|
||||
|
||||
return this
|
||||
},
|
||||
|
||||
createUser: function (username, email, password) {
|
||||
return this
|
||||
.click('@accountsNewAccountTrigger')
|
||||
.setValue('@newAccountInputUsername', username)
|
||||
.setValue('@newAccountInputEmail', email)
|
||||
.setValue('@newAccountInputPassword', password)
|
||||
.click('@newAccountButtonConfirm')
|
||||
}
|
||||
},
|
||||
|
||||
elements: {
|
||||
accountsApp: {
|
||||
selector: '#accounts-app'
|
||||
},
|
||||
accountsListTable: {
|
||||
selector: "//table[@class='uk-table uk-table-middle uk-table-divider']",
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
userInAccountsList: {
|
||||
selector: '//table//td[text()="%s"]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
rowByUsername: {
|
||||
selector: '//table//td[text()="%s"]/ancestor::tr',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
currentRole: {
|
||||
selector: '//span[contains(@class, "accounts-roles-current-role") and normalize-space()="%s"]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
roleInRolesDropdown: {
|
||||
selector: '//label[contains(@class, "accounts-roles-dropdown-role") and normalize-space()="%s"]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
rolesDropdownTrigger: {
|
||||
selector: '//button[contains(@class, "accounts-roles-select-trigger")]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
loadingAccountsList: {
|
||||
selector: '//div[contains(@class, "oc-loader")]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
rowCheckbox: {
|
||||
selector: '//input[@class="oc-checkbox"]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
batchActionDisable: {
|
||||
selector: '#accounts-batch-action-disable'
|
||||
},
|
||||
batchActionEnable: {
|
||||
selector: '#accounts-batch-action-enable'
|
||||
},
|
||||
batchActionDelete: {
|
||||
selector: '#accounts-batch-action-delete'
|
||||
},
|
||||
batchActionDeleteCancel: {
|
||||
selector: '#accounts-batch-action-delete-cancel'
|
||||
},
|
||||
batchActionDeleteConfirm: {
|
||||
selector: '#accounts-batch-action-delete-confirm'
|
||||
},
|
||||
statusIndicator: {
|
||||
selector: '//span[contains(@class, "accounts-status-indicator-%s")]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
newAccountInputUsername: {
|
||||
selector: '#accounts-new-account-input-username'
|
||||
},
|
||||
newAccountInputEmail: {
|
||||
selector: '#accounts-new-account-input-email'
|
||||
},
|
||||
newAccountInputPassword: {
|
||||
selector: '#accounts-new-account-input-password'
|
||||
},
|
||||
newAccountButtonConfirm: {
|
||||
selector: '#accounts-new-account-button-confirm'
|
||||
},
|
||||
accountsNewAccountTrigger: {
|
||||
selector: '#accounts-new-account-trigger'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
const assert = require('assert')
|
||||
const { client } = require('nightwatch-api')
|
||||
const { Given, When, Then } = require('cucumber')
|
||||
|
||||
When('the user browses to the accounts page', function () {
|
||||
return client.page.accountsPage().navigateAndWaitUntilMounted()
|
||||
})
|
||||
|
||||
Then('user {string} should be displayed in the accounts list on the WebUI', async function (username) {
|
||||
await client.page.accountsPage().accountsList()
|
||||
const userListed = await client.page.accountsPage().isUserListed(username)
|
||||
return assert.strictEqual(userListed, true)
|
||||
})
|
||||
|
||||
Then('user {string} should not be displayed in the accounts list on the WebUI', async function (username) {
|
||||
await client.page.accountsPage().accountsList()
|
||||
const userDeleted = await client.page.accountsPage().isUserDeleted(username)
|
||||
return assert.strictEqual(userDeleted, true)
|
||||
})
|
||||
|
||||
Given('the user has changed the role of user {string} to {string}', function (username, role) {
|
||||
return client.page.accountsPage().selectRole(username, role)
|
||||
})
|
||||
|
||||
When('the user changes the role of user {string} to {string} using the WebUI', function (username, role) {
|
||||
return client.page.accountsPage().selectRole(username, role)
|
||||
})
|
||||
|
||||
Then('the displayed role of user {string} should be {string} on the WebUI', function (username, role) {
|
||||
return client.page.accountsPage().checkUsersRole(username, role)
|
||||
})
|
||||
|
||||
Then('the user should not be able to see the accounts list on the WebUI', async function () {
|
||||
return client.page.accountsPage()
|
||||
.waitForAjaxCallsToStartAndFinish()
|
||||
.waitForElementVisible('@loadingAccountsList')
|
||||
.waitForElementNotPresent('@accountsListTable')
|
||||
})
|
||||
|
||||
When('the user disables user/users {string} using the WebUI', function (usernames) {
|
||||
return client.page.accountsPage().setUserActivated(usernames, false)
|
||||
})
|
||||
|
||||
When('the user enables user/users {string} using the WebUI', function (usernames) {
|
||||
return client.page.accountsPage().setUserActivated(usernames, true)
|
||||
})
|
||||
|
||||
Then('the status indicator of user/users {string} should be {string} on the WebUI', function (usernames, status) {
|
||||
return client.page.accountsPage().checkUsersStatus(usernames, status)
|
||||
})
|
||||
|
||||
When(
|
||||
'the user creates a new user with username {string}, email {string} and password {string} using the WebUI',
|
||||
function (username, email, password) {
|
||||
return client.page.accountsPage().createUser(username, email, password)
|
||||
}
|
||||
)
|
||||
|
||||
When('the user deletes user/users {string} using the WebUI', function (usernames) {
|
||||
return client.page.accountsPage().deleteUsers(usernames)
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
# OpenID Connect client registry.
|
||||
clients:
|
||||
- id: phoenix
|
||||
name: OCIS
|
||||
application_type: web
|
||||
insecure: yes
|
||||
trusted: yes
|
||||
redirect_uris:
|
||||
- https://ocis-server:9200/oidc-callback.html
|
||||
- https://ocis-server:9200/
|
||||
origins:
|
||||
- https://ocis-server:9200
|
||||
|
||||
authorities:
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"server": "https://ocis-server:9200",
|
||||
"theme": "owncloud",
|
||||
"version": "0.1.0",
|
||||
"openIdConnect": {
|
||||
"metadata_url": "https://ocis-server:9200/.well-known/openid-configuration",
|
||||
"authority": "https://ocis-server:9200",
|
||||
"client_id": "phoenix",
|
||||
"response_type": "code",
|
||||
"scope": "openid profile email"
|
||||
},
|
||||
"apps": [
|
||||
"files",
|
||||
"draw-io",
|
||||
"pdf-viewer",
|
||||
"markdown-editor",
|
||||
"media-viewer"
|
||||
],
|
||||
"external_apps": [
|
||||
{
|
||||
"id": "accounts",
|
||||
"path": "https://ocis-server:9200/accounts.js",
|
||||
"config": {
|
||||
"url": "https://ocis-server:9200"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$PHOENIX_PATH" ]
|
||||
then
|
||||
echo "PHOENIX_PATH env variable is not set, cannot find files for tests infrastructure"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$OCIS_SKELETON_DIR" ]
|
||||
then
|
||||
echo "OCIS_SKELETON_DIR env variable is not set, cannot find skeleton directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PHOENIX_CONFIG" ]
|
||||
then
|
||||
echo "PHOENIX_CONFIG env variable is not set, cannot find phoenix config file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Features path not given, exiting test run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap clean_up SIGHUP SIGINT SIGTERM
|
||||
|
||||
if [ -z "$TEST_INFRA_DIRECTORY" ]
|
||||
then
|
||||
cleanup=true
|
||||
testFolder=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||
printf "creating folder $testFolder for Test infrastructure setup\n\n"
|
||||
export TEST_INFRA_DIRECTORY=$testFolder
|
||||
fi
|
||||
|
||||
clean_up() {
|
||||
if $cleanup
|
||||
then
|
||||
if [ -d "$testFolder" ]; then
|
||||
printf "\n\n\n\nDeleting folder $testFolder Test infrastructure setup..."
|
||||
rm -rf "$testFolder"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
trap clean_up SIGHUP SIGINT SIGTERM EXIT
|
||||
|
||||
cp -r "$PHOENIX_PATH"/tests ./"$testFolder"
|
||||
|
||||
export SERVER_HOST=${SERVER_HOST:-https://localhost:9200}
|
||||
export BACKEND_HOST=${BACKEND_HOST:-https://localhost:9200}
|
||||
export RUN_ON_OCIS='true'
|
||||
export TEST_TAGS=${TEST_TAGS:-"not @skip"}
|
||||
|
||||
yarn run acceptance-tests "$1"
|
||||
|
||||
status=$?
|
||||
exit $status
|
||||
Reference in New Issue
Block a user