-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Description of the Changes - Added a new service for Kaltura User Get using it inside the OVPProvider - Concentrated the dealing with the flag config.session._isAnonymous in a single place in the file, instead of several places. - Fixed the flag config.session._isAnonymous logic: until now, config.session._isAnonymous was set to 'false' for every session that has ks (even if it's anonymous ks). The fix insure that the flag config.session._isAnonymous will be set to 'false' only for sessions that have ks containing a valid user inside, otherwise the flag will be set to 'true'. Related PR: kaltura/kaltura-player-js#916 [FEC-14248](https://kaltura.atlassian.net/browse/FEC-14248) [FEC-14248]: https://kaltura.atlassian.net/browse/FEC-14248?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Roee Dean <[email protected]>
- Loading branch information
Showing
6 changed files
with
274 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/k-provider/ovp/response-types/kaltura-user-get-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export class KalturaUserGetResponse { | ||
public id: string; | ||
private static readonly INVALID_IDS = ['0', '', null, undefined]; | ||
|
||
constructor(response: any) { | ||
this.id = response.id; | ||
} | ||
|
||
public isAnonymous(): boolean { | ||
return KalturaUserGetResponse.INVALID_IDS.includes(this.id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import OVPService from './ovp-service'; | ||
import RequestBuilder from '../../../util/request-builder'; | ||
|
||
const SERVICE_NAME: string = 'user'; | ||
|
||
export default class OVPUserService extends OVPService { | ||
/** | ||
* Creates an instance of RequestBuilder for user.get | ||
* @function getPlaybackContext | ||
* @param {string} serviceUrl The service base URL | ||
* @param {string} ks The ks | ||
* @returns {RequestBuilder} The request builder | ||
* @static | ||
*/ | ||
public static get(serviceUrl: string, ks: string): RequestBuilder { | ||
const headers: Map<string, string> = new Map(); | ||
headers.set('Content-Type', 'application/json'); | ||
const request = new RequestBuilder(headers); | ||
request.service = SERVICE_NAME; | ||
request.action = 'get'; | ||
request.method = 'POST'; | ||
request.url = request.getUrl(serviceUrl); | ||
request.tag = 'user-get'; | ||
request.params = { ks: ks, format: 1 }; | ||
return request; | ||
} | ||
} |
Oops, something went wrong.