* Implemented the ability to disable authentication on a server instance. Admins will require authentication, but non-admin accounts can be setup without any password requirements. * WIP for new login page. * Reworked code to handle disabled auth better. First time user flow is moved into the user login component. * Removed debug code * Removed home component, shakeout testing is complete. * remove a file accidently committed * Fixed a code smell from last PR * Code smells
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { HttpClient } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { environment } from 'src/environments/environment';
|
|
import { Member } from '../_models/member';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class MemberService {
|
|
|
|
baseUrl = environment.apiUrl;
|
|
|
|
constructor(private httpClient: HttpClient) { }
|
|
|
|
getMembers() {
|
|
return this.httpClient.get<Member[]>(this.baseUrl + 'users');
|
|
}
|
|
|
|
getMemberNames() {
|
|
return this.httpClient.get<string[]>(this.baseUrl + 'users/names');
|
|
}
|
|
|
|
adminExists() {
|
|
return this.httpClient.get<boolean>(this.baseUrl + 'admin/exists');
|
|
}
|
|
|
|
deleteMember(username: string) {
|
|
return this.httpClient.delete(this.baseUrl + 'users/delete-user?username=' + username);
|
|
}
|
|
|
|
hasLibraryAccess(libraryId: number) {
|
|
return this.httpClient.get<boolean>(this.baseUrl + 'users/has-library-access?libraryId=' + libraryId);
|
|
}
|
|
|
|
hasReadingProgress(librayId: number) {
|
|
return this.httpClient.get<boolean>(this.baseUrl + 'users/has-reading-progress?libraryId=' + librayId);
|
|
}
|
|
|
|
updateMemberRoles(username: string, roles: string[]) {
|
|
return this.httpClient.post(this.baseUrl + 'account/update-rbs', {username, roles});
|
|
}
|
|
}
|