assets/angular/shared/roles-service.ts
Role related service
Author: Shilo Banihit
Methods |
constructor(http: Http, configService: ConfigService)
|
||||||||||||
Defined in assets/angular/shared/roles-service.ts:34
|
||||||||||||
Parameters :
|
getBrandRoles |
getBrandRoles()
|
Defined in assets/angular/shared/roles-service.ts:40
|
Returns :
Promise<[]>
|
updateUserRoles |
updateUserRoles(userid: any, roleIds: any)
|
Defined in assets/angular/shared/roles-service.ts:46
|
Returns :
any
|
import { Injectable, Inject} from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import { BaseService } from '../shared/base-service'
import { SaveResult, Role, User, LoginResult } from './user-models'
import { ConfigService } from './config-service';
/**
* Role related service
*
* Author: <a href='https://github.com/shilob' target='_blank'>Shilo Banihit</a>
*/
@Injectable()
export class RolesService extends BaseService {
constructor (@Inject(Http) http: Http, @Inject(ConfigService) protected configService: ConfigService) {
super(http, configService);
}
getBrandRoles() :Promise<Role[]> {
return this.http.get(`${this.brandingAndPortalUrl}/admin/roles/get`, this.options)
.toPromise()
.then((res:any) => this.extractData(res) as Role[]);
}
updateUserRoles(userid: any, roleIds: any) {
return this.http.post(`${this.brandingAndPortalUrl}/admin/roles/user`, {userid: userid, roles:roleIds}, this.options)
.toPromise()
.then((res:any) => this.extractData(res) as SaveResult[]);
}
}