dtable-web-api
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -660,2 +660,178 @@ "use strict"; | ||
} | ||
}, { | ||
key: "sysAdminListUsers", | ||
value: function sysAdminListUsers(page, perPage, isLDAPImport) { | ||
var url = this.server + '/api/v2.1/admin/users/'; | ||
var params = { | ||
page: page, | ||
per_page: perPage | ||
}; | ||
if (isLDAPImport) { | ||
url += '?source=ldapimport'; | ||
} | ||
return this.req.get(url, { | ||
params: params | ||
}); | ||
} | ||
}, { | ||
key: "sysAdminAddUser", | ||
value: function sysAdminAddUser(email, name, role, password) { | ||
var url = this.server + '/api/v2.1/admin/users/'; | ||
var formData = new _formData["default"](); | ||
formData.append('email', email); | ||
formData.append('name', name); | ||
formData.append('role', role); | ||
formData.append('password', password); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminUpdateUser", | ||
value: function sysAdminUpdateUser(email, attribute, value) { | ||
var url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
var formData = new _formData["default"](); | ||
switch (attribute) { | ||
case 'password': | ||
formData.append('password', value); | ||
break; | ||
case 'is_active': | ||
formData.append('is_active', value); | ||
break; | ||
case 'is_staff': | ||
formData.append('is_staff', value); | ||
break; | ||
case 'role': | ||
formData.append('role', value); | ||
break; | ||
case 'name': | ||
formData.append('name', value); | ||
break; | ||
case 'login_id': | ||
formData.append('login_id', value); | ||
break; | ||
case 'contact_email': | ||
formData.append('contact_email', value); | ||
break; | ||
case 'reference_id': | ||
formData.append('reference_id', value); | ||
break; | ||
case 'department': | ||
formData.append('department', value); | ||
break; | ||
case 'quota_total': | ||
formData.append('quota_total', value); | ||
break; | ||
case 'institution': | ||
formData.append('institution', value); | ||
break; | ||
} | ||
return this.req.put(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminDeleteUser", | ||
value: function sysAdminDeleteUser(email) { | ||
var url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
return this.req["delete"](url); | ||
} | ||
}, { | ||
key: "sysAdminGetUser", | ||
value: function sysAdminGetUser(email, avatarSize) { | ||
var url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
var params = {}; | ||
if (avatarSize) { | ||
params.avatar_size = avatarSize; | ||
} | ||
return this.req.get(url, { | ||
params: params | ||
}); | ||
} | ||
}, { | ||
key: "sysAdminResetUserPassword", | ||
value: function sysAdminResetUserPassword(email) { | ||
var url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/reset-password/'; | ||
return this.req.put(url); | ||
} | ||
}, { | ||
key: "sysAdminSetUserQuotaInBatch", | ||
value: function sysAdminSetUserQuotaInBatch(emails, quotaTotal) { | ||
var url = this.server + '/api/v2.1/admin/users/batch/'; | ||
var formData = new _formData["default"](); | ||
emails.map(function (email) { | ||
formData.append('email', email); | ||
}); | ||
formData.append('operation', 'set-quota'); | ||
formData.append('quota_total', quotaTotal); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminDeleteUserInBatch", | ||
value: function sysAdminDeleteUserInBatch(emails) { | ||
var url = this.server + '/api/v2.1/admin/users/batch/'; | ||
var formData = new _formData["default"](); | ||
emails.map(function (email) { | ||
formData.append('email', email); | ||
}); | ||
formData.append('operation', 'delete-user'); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminImportUserViaFile", | ||
value: function sysAdminImportUserViaFile(file) { | ||
var url = this.server + '/api/v2.1/admin/import-users/'; | ||
var formData = new _formData["default"](); | ||
formData.append('file', file); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminListAdmins", | ||
value: function sysAdminListAdmins() { | ||
var url = this.server + '/api/v2.1/admin/admin-users/'; | ||
return this.req.get(url); | ||
} | ||
}, { | ||
key: "sysAdminUpdateAdminRole", | ||
value: function sysAdminUpdateAdminRole(email, role) { | ||
var url = this.server + '/api/v2.1/admin/admin-role/'; | ||
var formData = new _formData["default"](); | ||
formData.append('email', email); | ||
formData.append('role', role); | ||
return this.req.put(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminAddAdminInBatch", | ||
value: function sysAdminAddAdminInBatch(emails) { | ||
var url = this.server + '/api/v2.1/admin/admin-users/batch/'; | ||
var formData = new _formData["default"](); | ||
emails.map(function (email) { | ||
formData.append('email', email); | ||
}); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
}, { | ||
key: "sysAdminListGroupsJoinedByUser", | ||
value: function sysAdminListGroupsJoinedByUser(email) { | ||
var url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/groups/'; | ||
return this.req.get(url); | ||
} | ||
}, { | ||
key: "sysAdminDismissGroupByID", | ||
value: function sysAdminDismissGroupByID(groupID) { | ||
var url = this.server + '/api/v2.1/admin/groups/' + groupID + '/'; | ||
return this.req["delete"](url); | ||
} | ||
}]); | ||
@@ -662,0 +838,0 @@ |
{ | ||
"name": "dtable-web-api", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "an interface for dtable-web", | ||
@@ -5,0 +5,0 @@ "main": "lib/dtable-web-api.js", |
@@ -519,4 +519,146 @@ import axios from 'axios'; | ||
sysAdminListUsers(page, perPage, isLDAPImport) { | ||
let url = this.server + '/api/v2.1/admin/users/'; | ||
let params = { | ||
page: page, | ||
per_page: perPage | ||
}; | ||
if (isLDAPImport) { | ||
url += '?source=ldapimport'; | ||
} | ||
return this.req.get(url, {params: params}); | ||
} | ||
sysAdminAddUser(email, name, role, password) { | ||
const url = this.server + '/api/v2.1/admin/users/'; | ||
let formData = new FormData(); | ||
formData.append('email', email); | ||
formData.append('name', name); | ||
formData.append('role', role); | ||
formData.append('password', password); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
sysAdminUpdateUser(email, attribute, value) { | ||
const url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
let formData = new FormData(); | ||
switch (attribute) { | ||
case 'password': | ||
formData.append('password', value); | ||
break; | ||
case 'is_active': | ||
formData.append('is_active', value); | ||
break; | ||
case 'is_staff': | ||
formData.append('is_staff', value); | ||
break; | ||
case 'role': | ||
formData.append('role', value); | ||
break; | ||
case 'name': | ||
formData.append('name', value); | ||
break; | ||
case 'login_id': | ||
formData.append('login_id', value); | ||
break; | ||
case 'contact_email': | ||
formData.append('contact_email', value); | ||
break; | ||
case 'reference_id': | ||
formData.append('reference_id', value); | ||
break; | ||
case 'department': | ||
formData.append('department', value); | ||
break; | ||
case 'quota_total': | ||
formData.append('quota_total', value); | ||
break; | ||
case 'institution': | ||
formData.append('institution', value); | ||
break; | ||
} | ||
return this.req.put(url, formData); | ||
} | ||
sysAdminDeleteUser(email) { | ||
const url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
return this.req.delete(url); | ||
} | ||
sysAdminGetUser(email, avatarSize) { | ||
const url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/'; | ||
let params = {}; | ||
if (avatarSize) { | ||
params.avatar_size = avatarSize; | ||
} | ||
return this.req.get(url, {params: params}); | ||
} | ||
sysAdminResetUserPassword(email) { | ||
const url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/reset-password/'; | ||
return this.req.put(url); | ||
} | ||
sysAdminSetUserQuotaInBatch(emails, quotaTotal) { | ||
const url = this.server + '/api/v2.1/admin/users/batch/'; | ||
let formData = new FormData(); | ||
emails.map(email => { | ||
formData.append('email', email); | ||
}); | ||
formData.append('operation', 'set-quota'); | ||
formData.append('quota_total', quotaTotal); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
sysAdminDeleteUserInBatch(emails) { | ||
const url = this.server + '/api/v2.1/admin/users/batch/'; | ||
let formData = new FormData(); | ||
emails.map(email => { | ||
formData.append('email', email); | ||
}); | ||
formData.append('operation', 'delete-user'); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
sysAdminImportUserViaFile(file) { | ||
const url = this.server + '/api/v2.1/admin/import-users/'; | ||
let formData = new FormData(); | ||
formData.append('file', file); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
sysAdminListAdmins() { | ||
const url = this.server + '/api/v2.1/admin/admin-users/'; | ||
return this.req.get(url); | ||
} | ||
sysAdminUpdateAdminRole(email, role) { | ||
const url = this.server + '/api/v2.1/admin/admin-role/'; | ||
let formData = new FormData(); | ||
formData.append('email', email); | ||
formData.append('role', role); | ||
return this.req.put(url, formData); | ||
} | ||
sysAdminAddAdminInBatch(emails) { | ||
const url = this.server + '/api/v2.1/admin/admin-users/batch/'; | ||
let formData = new FormData(); | ||
emails.map(email => { | ||
formData.append('email', email); | ||
}); | ||
return this._sendPostRequest(url, formData); | ||
} | ||
sysAdminListGroupsJoinedByUser(email) { | ||
const url = this.server + '/api/v2.1/admin/users/' + encodeURIComponent(email) + '/groups/'; | ||
return this.req.get(url); | ||
} | ||
sysAdminDismissGroupByID(groupID) { | ||
const url = this.server + '/api/v2.1/admin/groups/' + groupID + '/'; | ||
return this.req.delete(url); | ||
} | ||
} | ||
export default DTableWebAPI; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50437
1355