refactor accounts

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-04-13 17:04:35 +02:00
parent 1c5d02da20
commit 2089ac5f7b
98 changed files with 95 additions and 11584 deletions
+44
View File
@@ -0,0 +1,44 @@
import 'regenerator-runtime/runtime'
import App from './components/App.vue'
import store from './store'
import translations from './../l10n/translations.json'
// just a dummy function to trick gettext tools
function $gettext (msg) {
return msg
}
const appInfo = {
name: $gettext('Accounts'),
id: 'accounts',
icon: 'team',
isFileEditor: false
}
const routes = [
{
name: 'accounts',
path: '/',
component: App
}
]
const navItems = [
{
name: $gettext('Accounts'),
icon: appInfo.icon,
route: {
name: 'accounts',
path: `/${appInfo.id}/`
},
menu: 'apps'
}
]
export default {
appInfo,
routes,
navItems,
store,
translations
}
@@ -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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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 = '/v1/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 '/v1/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 = '/v1/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('&')) : '')
}
+74
View File
@@ -0,0 +1,74 @@
<template>
<div>
<main class="oc-flex oc-flex-column oc-height-1-1 oc-p-m" id="accounts-app">
<template v-if="isInitialized">
<h1 class="oc-invisible-sr">
<translate>Accounts</translate>
</h1>
<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="oc-flex-1 oc-overflow-auto">
<div class="oc-width-expand">
<accounts-list :accounts="accounts" />
</div>
</oc-grid>
</template>
<template v-else-if="hasFailed">
<oc-alert
variation="warning"
no-close
class="oc-m"
id="accounts-list-loading-failed"
>
<oc-icon
name="error-warning"
variation="warning"
class="oc-float-left oc-mr-s"
/>
<translate>You don't have permissions to manage accounts.</translate>
</oc-alert>
</template>
<oc-loader id="accounts-list-loader" v-else />
</main>
</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',
'hasFailed',
'getAccountsSorted',
'isAnyAccountSelected'
]),
...mapState('Accounts', ['selectedAccounts']),
accounts () {
return this.getAccountsSorted
},
numberOfSelectedAccounts () {
return this.selectedAccounts.length
}
},
methods: {
...mapActions('Accounts', ['initialize'])
},
created () {
this.initialize()
}
}
</script>
@@ -0,0 +1,157 @@
<template>
<oc-grid key="selected-accounts-info" gutter="small" class="oc-flex-middle">
<span v-text="selectionInfoText" />
<span>|</span>
<div>
<oc-button
v-text="$gettext('Clear selection')"
appearance="raw"
@click="RESET_ACCOUNTS_SELECTION"
/>
</div>
<oc-grid gutter="small" id="accounts-batch-actions">
<div v-for="action in actions" :key="action.label">
<div
v-if="isConfirmationInProgress[action.id]"
:variation="action.confirmation.variation || 'primary'"
noClose
class="oc-flex oc-flex-middle tmp-alert-fixes"
>
<span>{{ action.confirmation.message }}</span>
<oc-button
:id="action.confirmation.cancel.id"
@click="action.confirmation.cancel.handler"
:variation="action.confirmation.cancel.variation || 'passive'"
>
{{ action.confirmation.cancel.label }}
</oc-button>
<oc-button
:id="action.confirmation.confirm.id"
@click="action.confirmation.confirm.handler"
:variation="action.confirmation.confirm.variation || 'primary'"
>
{{ action.confirmation.confirm.label }}
</oc-button>
</div>
<oc-button
v-else
:id="action.id"
@click="action.handler"
:variation="action.variation || 'primary'"
: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',
variation: 'danger',
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'),
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 lang="scss" scoped>
.tmp-alert-fixes {
color: rgb(224, 0, 0) !important;
font-size: 1.125rem !important;
font-weight: 600 !important;
line-height: 1.4 !important;
}
.tmp-alert-fixes > *:not(:last-child) {
margin-right: 8px;
}
.tmp-alert-fixes > button {
padding: 0.2rem 0.5rem;
}
</style>
@@ -0,0 +1,196 @@
<template>
<div>
<oc-grid v-if="isFormInProgress" gutter="small">
<oc-text-input
id="accounts-new-account-input-username"
type="text"
v-model="formData.username"
:error-message="formValidation.usernameError"
:label="$gettext('Username')"
:disabled="isRequestInProgress"
@keydown.enter="createAccount"
/>
<oc-text-input
id="accounts-new-account-input-email"
type="email"
v-model="formData.email"
:error-message="formValidation.emailError"
:label="$gettext('Email')"
:disabled="isRequestInProgress"
@keydown.enter="createAccount"
/>
<oc-text-input
id="accounts-new-account-input-password"
type="password"
v-model="formData.password"
:error-message="formValidation.passwordError"
:label="$gettext('Password')"
:disabled="isRequestInProgress"
@keydown.enter="createAccount"
/>
<div class="oc-flex">
<oc-button
class="oc-mr-s oc-mb-s"
v-text="$gettext('Cancel')"
@click="cancelForm"
:disabled="isRequestInProgress"
/>
<oc-button
id="accounts-new-account-button-confirm"
class="oc-mr-s oc-mb-s"
variation="primary"
appearance="filled"
:disabled="isRequestInProgress"
@click="createAccount"
gap-size="small"
:class="{ 'border-ods-tmp-fix': !isRequestInProgress }"
>
<oc-spinner
v-if="isRequestInProgress"
key="account-creation-in-progress"
size="small"
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"
variation="primary"
appearance="filled"
gap-size="small"
@click="setFormInProgress(true)"
>
<oc-icon name="user-add" />
<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,65 @@
<template>
<div>
<oc-table-simple id="accounts-user-list" class="oc-mt-l">
<oc-thead>
<oc-tr>
<oc-th shrink type="head" align-h="center">
<oc-checkbox
class="oc-ml-s"
:value="areAllAccountsSelected"
@input="toggleSelectionAll"
:label="$gettext('Select all users')"
hide-label
/>
</oc-th>
<oc-th shrink type="head" />
<oc-th type="head" v-text="$gettext('Username')" />
<oc-th type="head" v-text="$gettext('Display name')" />
<oc-th type="head" v-text="$gettext('Email')" />
<oc-th type="head" v-text="$gettext('Role')" />
<oc-th
shrink
type="head"
v-text="$gettext('Activated')"
align-h="center"
/>
</oc-tr>
</oc-thead>
<oc-tbody>
<accounts-list-row
v-for="account in accounts"
:key="`account-list-row-${account.id}`"
:account="account"
/>
</oc-tbody>
</oc-table-simple>
</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,170 @@
<template>
<oc-tr>
<oc-td align-h="center">
<oc-checkbox
class="oc-ml-s"
size="large"
:value="selectedAccounts"
:option="account"
@input="TOGGLE_SELECTION_ACCOUNT(account)"
:label="selectAccountLabel"
hide-label
/>
</oc-td>
<oc-td>
<avatar
:user-name="account.displayName || account.onPremisesSamAccountName"
:userid="account.id"
:width="35"
/>
</oc-td>
<oc-td v-text="account.onPremisesSamAccountName" />
<oc-td v-text="account.displayName || '-'" />
<oc-td v-text="account.mail" />
<oc-td>
<oc-button
:id="`accounts-roles-select-trigger-${account.id}`"
class="accounts-roles-select-trigger"
appearance="outline"
>
<span class="oc-flex oc-flex-middle accounts-roles-current-role">
{{ currentRole ? currentRole.displayName : $gettext("Select role") }}
<oc-icon name="arrow-down-s" 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="oc-list">
<li v-for="role in roles" :key="role.id">
<oc-radio
class="accounts-roles-dropdown-role"
v-model="currentRole"
:option="role"
@input="changeRole(role.id)"
:label="role.displayName"
/>
</li>
</ul>
</oc-drop>
</oc-td>
<oc-td align-h="center">
<oc-icon
v-if="account.accountEnabled"
key="account-icon-enabled"
name="user-follow"
variation="success"
:aria-label="$gettext('Account is activated')"
class="accounts-status-indicator-enabled"
/>
<oc-icon
v-else
key="account-icon-disabled"
name="user-unfollow"
variation="danger"
:aria-label="$gettext('Account is blocked')"
class="accounts-status-indicator-disabled"
/>
</oc-td>
</oc-tr>
</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', 'getServerForJsClient']),
...mapState('Accounts', ['roles', 'selectedAccounts']),
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.getServerForJsClient,
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.getServerForJsClient,
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 ownCloud Web. 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', 'configuration']),
enabled: function () {
return this.configuration.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.configuration.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>
+16
View File
@@ -0,0 +1,16 @@
/**
* This file contains strings that should be synced to transifex but not exist in the UI directly,
* moreover, they get loaded for example by API requests
*/
// just a dummy function to trick gettext tools
function $gettext (msg) {
return msg
}
// eslint-disable-next-line no-unused-vars
const dictionary = [
$gettext('Guest'),
$gettext('Admin'),
$gettext('User')
]
+12
View File
@@ -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
})
}
+8
View File
@@ -0,0 +1,8 @@
/**
* Asserts whether 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
}
+253
View File
@@ -0,0 +1,253 @@
/* 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 = {
initialized: false,
failed: false,
accounts: {},
roles: null,
selectedAccounts: []
}
const getters = {
isInitialized: state => state.initialized,
hasFailed: state => state.failed,
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,
getServerForJsClient: (state, getters, rootState, rootGetters) => rootGetters.configuration.server.replace(/\/$/, '')
}
const mutations = {
SET_INITIALIZED (state, value) {
state.initialized = value
},
SET_FAILED (state, value) {
state.failed = 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 = {
async initialize ({ commit, dispatch, getters }) {
await Promise.all([
dispatch('fetchAccounts'),
dispatch('fetchRoles')
])
if (!getters.hasFailed) {
commit('SET_INITIALIZED', true)
}
},
async fetchAccounts ({ commit, getters, rootGetters }) {
injectAuthToken(rootGetters.user.token)
try {
const response = await AccountsService_ListAccounts({
$domain: getters.getServerForJsClient,
body: {}
})
if (response.status === 201) {
const accounts = response.data.accounts
commit('SET_ACCOUNTS', accounts || [])
return
}
} catch (e) {
}
commit('SET_FAILED', true)
},
async fetchRoles ({ commit, getters, rootGetters }) {
injectAuthToken(rootGetters.user.token)
try {
const response = await RoleService_ListRoles({
$domain: getters.getServerForJsClient,
body: {}
})
if (response.status === 201) {
const roles = response.data.bundles
commit('SET_ROLES', roles || [])
return
}
} catch (e) {
}
commit('SET_FAILED', true)
},
toggleSelectionAll ({ commit, getters, state }) {
getters.areAllAccountsSelected ? commit('RESET_ACCOUNTS_SELECTION') : commit('SET_SELECTED_ACCOUNTS', [...state.accounts])
},
async setAccountActivated ({ commit, dispatch, state, getters, 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: getters.getServerForJsClient,
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 ({ getters, rootGetters, commit, dispatch }, account) {
injectAuthToken(rootGetters.user.token)
try {
const response = await AccountsService_CreateAccount({
$domain: getters.getServerForJsClient,
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 ({ getters, rootGetters, state, commit, dispatch }) {
const failedAccounts = []
injectAuthToken(rootGetters.user.token)
for (const account of state.selectedAccounts) {
try {
const response = await AccountsService_DeleteAccount({
$domain: getters.getServerForJsClient,
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,75 @@
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 "idp" 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
@skip @issue-product-167
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
@skip @issue-product-167
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,174 @@
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 roleTrigger =
util.format(this.elements.rowByUsername.selector, username) +
this.elements.rolesDropdownTrigger.selector
const roleSelector =
util.format(this.elements.rowByUsername.selector, username) +
util.format(this.elements.roleInRolesDropdown.selector, role)
return this
.initAjaxCounters()
.waitForElementVisible(roleTrigger)
.click(roleTrigger)
.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: '#accounts-user-list'
},
userInAccountsList: {
selector: '//table[@id="accounts-user-list"]//td[text()="%s"]',
locateStrategy: 'xpath'
},
rowByUsername: {
selector: '//table[@id="accounts-user-list"]//td[text()="%s"]/ancestor::tr',
locateStrategy: 'xpath'
},
currentRole: {
selector: '//span[contains(@class, "accounts-roles-current-role") and normalize-space()="%s"]',
locateStrategy: 'xpath'
},
roleInRolesDropdown: {
selector: '//span[contains(@class, "accounts-roles-dropdown-role")]/label[normalize-space()="%s"]',
locateStrategy: 'xpath'
},
rolesDropdownTrigger: {
selector: '//button[contains(@class, "accounts-roles-select-trigger")]',
locateStrategy: 'xpath'
},
loadingAccountsList: {
selector: '#accounts-list-loader'
},
loadingAccountsListFailed: {
selector: '#accounts-list-loading-failed'
},
rowCheckbox: {
selector: '//input[contains(@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,60 @@
const assert = require('assert')
const { client } = require('nightwatch-api')
const { Given, When, Then } = require('@cucumber/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('@loadingAccountsListFailed')
})
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)
})
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
if [ -z "$WEB_PATH" ]
then
echo "WEB_PATH env variable is not set, cannot find files for tests infrastructure"
exit 1
fi
if [ -z "$WEB_UI_CONFIG" ]
then
echo "WEB_UI_CONFIG env variable is not set, cannot find web 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=$(mktemp -d -p .)
printf "creating folder $testFolder for Test infrastructure setup\n\n"
export TEST_INFRA_DIRECTORY=$(realpath $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 $(ls -d "$WEB_PATH"/tests/acceptance/* | grep -v 'node_modules') "$testFolder"
export SERVER_HOST=${SERVER_HOST:-https://localhost:9200}
export BACKEND_HOST=${BACKEND_HOST:-https://localhost:9200}
export TEST_TAGS=${TEST_TAGS:-"not @skip"}
yarn run acceptance-tests "$1"
status=$?
exit $status