diff --git a/backend/files/system/auth/email-taken.get.hl b/backend/files/system/auth/email-taken.get.hl deleted file mode 100644 index f7db602804..0000000000 --- a/backend/files/system/auth/email-taken.get.hl +++ /dev/null @@ -1,39 +0,0 @@ - -/* - * Checks to see if the specified email is available or not. - */ -.arguments - email:string -.description:Checks to see if the specified email is available or not -.type:public - -// Sanity checking invocation. -validators.mandatory:x:@.arguments/*/email -validators.email:x:@.arguments/*/email - -// Trimming email before proceeding. -set-value:x:@.arguments/*/email - strings.trim:x:@.arguments/*/email - -// Verifying user exists and has not already verified his or her email address. -data.connect:magic - - // Checking if username exists in database. - data.read - table:users_extra - where - and - value:x:@.arguments/*/email - type:email - if - exists:x:@data.read/*/* - .lambda - - // No such user. - return - result:email-taken - - -// Returns success to caller. -return-nodes - result:email-available diff --git a/backend/files/system/auth/generate-key.get.hl b/backend/files/system/auth/generate-token.get.hl similarity index 100% rename from backend/files/system/auth/generate-key.get.hl rename to backend/files/system/auth/generate-token.get.hl diff --git a/backend/files/system/auth/impersonate.get.hl b/backend/files/system/auth/impersonate.get.hl deleted file mode 100644 index 9828db56b1..0000000000 --- a/backend/files/system/auth/impersonate.get.hl +++ /dev/null @@ -1,24 +0,0 @@ - -// Generates a JWT token for the specified user -.arguments - username:string -.description:Generates a JWT token for the specified user allowing you to impersonate that user in Magic -.type:internal - -// Ensures user is authorized to access endpoint. -auth.ticket.verify:root - -// Sanity checking invocation. -validators.mandatory:x:@.arguments/*/username - -/* - * Invokes [magic.auth.authenticate] that does the heavy lifting, and creates our JWT token, - * making sure we return the token to the caller. - */ -unwrap:x:+/* -signal:magic.auth.authenticate - username:x:@.arguments/*/username - check-password:bool:false - -// Returns the authentication JWT ticket created above to caller. -return-nodes:x:@signal/* diff --git a/frontend/src/app/_protected/pages/manage/user-and-roles/_services/user.service.ts b/frontend/src/app/_protected/pages/manage/user-and-roles/_services/user.service.ts index 71207f1098..adc1daf15f 100644 --- a/frontend/src/app/_protected/pages/manage/user-and-roles/_services/user.service.ts +++ b/frontend/src/app/_protected/pages/manage/user-and-roles/_services/user.service.ts @@ -36,6 +36,7 @@ export class UserService { * @param filter Optional query filter deciding which items to return */ list(params: string) { + return this.httpService.get('/magic/system/magic/users' + params); } @@ -45,6 +46,7 @@ export class UserService { * @param filter Optional query filter deciding which items to count */ count(params: string) { + return this.httpService.get('/magic/system/magic/users-count' + params); } @@ -55,6 +57,7 @@ export class UserService { * @param password Initial password for user */ create(username: string, password: string) { + return this.httpService.post('/magic/system/magic/users', { username, password @@ -67,6 +70,7 @@ export class UserService { * @param user User to update */ update(user: User) { + return this.httpService.put('/magic/system/magic/users', { username: user.username, password: user.password, @@ -83,6 +87,7 @@ export class UserService { * @param releaseDate Date and time for when user can access Magic again */ imprison(username: string, releaseDate: Date) { + return this.httpService.put('/magic/system/auth/imprison', { username, releaseDate, @@ -95,6 +100,7 @@ export class UserService { * @param username Username of user you want to delete */ delete(username: string) { + return this.httpService.delete('/magic/system/magic/users?username=' + encodeURIComponent(username)); } @@ -104,6 +110,7 @@ export class UserService { * @param username Username of user to retrieve roles for */ getRoles(username: string) { + return this.httpService.get('/magic/system/magic/users_roles?user.eq=' + encodeURIComponent(username)); } @@ -114,6 +121,7 @@ export class UserService { * @param role Name of role to add user to */ addRole(user: string, role: string) { + return this.httpService.post('/magic/system/magic/users_roles', { user, role, @@ -127,38 +135,20 @@ export class UserService { * @param role Name of role to remove user from */ removeRole(user: string, role: string) { + return this.httpService.delete('/magic/system/magic/users_roles?user=' + encodeURIComponent(user) + '&role=' + encodeURIComponent(role)); } - /** - * Creates a login link that can be used to authenticate as user. - * - * @param username Username to generate login link on behalf of - */ - public generateLoginLink(username: string) { - return this.httpService.get( - '/magic/system/auth/impersonate?username=' + - encodeURIComponent(username)); - } - - /** - * Creates a login link that can be used by user to reset his or her password (only!). - * - * @param username Username to generate login link on behalf of - */ - public generateResetPasswordLink(username: string) { - return this.httpService.get('/magic/system/auth/reset-password?username=' + encodeURIComponent(username)); - } - /** * Retrieving extra details of each user. * * @param username Username of the user */ public getUserExtra(username: string) { + return this.httpService.get('/magic/system/magic/users_extra?user.eq=' + encodeURIComponent(username)); } @@ -169,6 +159,7 @@ export class UserService { * @param username Username of the user */ public deleteExtra(type: string, username: string) { + return this.httpService.delete('/magic/system/magic/users_extra?type=' + encodeURIComponent(type) + '&user=' + encodeURIComponent(username)); } @@ -178,6 +169,7 @@ export class UserService { * @param extra Extra information */ public editExtra(extra: User_Extra) { + return this.httpService.put('/magic/system/magic/users_extra', extra); } @@ -187,6 +179,7 @@ export class UserService { * @param extra Extra information */ public addExtra(extra: User_Extra) { + return this.httpService.post('/magic/system/magic/users_extra', extra); } } diff --git a/frontend/src/app/_protected/pages/manage/user-and-roles/users-list/users-list.component.html b/frontend/src/app/_protected/pages/manage/user-and-roles/users-list/users-list.component.html index d4c3a61273..8bed4061bd 100644 --- a/frontend/src/app/_protected/pages/manage/user-and-roles/users-list/users-list.component.html +++ b/frontend/src/app/_protected/pages/manage/user-and-roles/users-list/users-list.component.html @@ -56,23 +56,6 @@
-
- - - - - -