Merge branch 'develop' of github.com:thecodingmachine/workadventure into develop
This commit is contained in:
@@ -320,10 +320,11 @@ export class AuthenticateController extends BaseHttpController {
|
||||
|
||||
//todo: what to do if the organizationMemberToken is already used?
|
||||
const organizationMemberToken: string | null = param.organizationMemberToken;
|
||||
const playUri: string | null = param.playUri;
|
||||
|
||||
try {
|
||||
if (typeof organizationMemberToken != "string") throw new Error("No organization token");
|
||||
const data = await adminApi.fetchMemberDataByToken(organizationMemberToken);
|
||||
const data = await adminApi.fetchMemberDataByToken(organizationMemberToken, playUri);
|
||||
const userUuid = data.userUuid;
|
||||
const email = data.email;
|
||||
const roomUrl = data.roomUrl;
|
||||
|
||||
@@ -13,14 +13,14 @@ export class OpenIdProfileController extends BaseHttpController {
|
||||
}
|
||||
try {
|
||||
const resCheckTokenAuth = await openIDClient.checkTokenAuth(accessToken as string);
|
||||
if (!resCheckTokenAuth.email) {
|
||||
if (!resCheckTokenAuth.sub) {
|
||||
throw new Error("Email was not found");
|
||||
}
|
||||
res.send(
|
||||
this.buildHtml(
|
||||
OPID_CLIENT_ISSUER,
|
||||
resCheckTokenAuth.email as string,
|
||||
resCheckTokenAuth.picture as string | undefined
|
||||
resCheckTokenAuth.sub
|
||||
/*resCheckTokenAuth.picture as string | undefined*/
|
||||
)
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import { ClientReadableStream } from "grpc";
|
||||
import { PositionDispatcher } from "_Model/PositionDispatcher";
|
||||
import Debug from "debug";
|
||||
import { BoolValue, UInt32Value } from "google-protobuf/google/protobuf/wrappers_pb";
|
||||
|
||||
const debug = Debug("zone");
|
||||
|
||||
@@ -125,9 +126,9 @@ export class UserDescriptor {
|
||||
export class GroupDescriptor {
|
||||
private constructor(
|
||||
public readonly groupId: number,
|
||||
private groupSize: number,
|
||||
private groupSize: number | undefined,
|
||||
private position: PointMessage,
|
||||
private locked: boolean
|
||||
private locked: boolean | undefined
|
||||
) {}
|
||||
|
||||
public static createFromGroupUpdateZoneMessage(message: GroupUpdateZoneMessage): GroupDescriptor {
|
||||
@@ -150,9 +151,13 @@ export class GroupDescriptor {
|
||||
throw new Error("GroupDescriptor.groupId is not an integer: " + this.groupId);
|
||||
}
|
||||
groupUpdateMessage.setGroupid(this.groupId);
|
||||
groupUpdateMessage.setGroupsize(this.groupSize);
|
||||
if (this.groupSize !== undefined) {
|
||||
groupUpdateMessage.setGroupsize(new UInt32Value().setValue(this.groupSize));
|
||||
}
|
||||
groupUpdateMessage.setPosition(this.position);
|
||||
groupUpdateMessage.setLocked(this.locked);
|
||||
if (this.locked !== undefined) {
|
||||
groupUpdateMessage.setLocked(new BoolValue().setValue(this.locked));
|
||||
}
|
||||
return groupUpdateMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class AdminApi {
|
||||
|
||||
async fetchMemberDataByUuid(
|
||||
userIdentifier: string | null,
|
||||
roomId: string,
|
||||
playUri: string,
|
||||
ipAddress: string,
|
||||
characterLayers: string[]
|
||||
): Promise<FetchMemberDataByUuidResponse> {
|
||||
@@ -69,7 +69,12 @@ class AdminApi {
|
||||
return Promise.reject(new Error("No admin backoffice set!"));
|
||||
}
|
||||
const res = await Axios.get<unknown, AxiosResponse<unknown>>(ADMIN_API_URL + "/api/room/access", {
|
||||
params: { userIdentifier, roomId, ipAddress, characterLayers },
|
||||
params: {
|
||||
userIdentifier,
|
||||
playUri,
|
||||
ipAddress,
|
||||
characterLayers,
|
||||
},
|
||||
headers: { Authorization: `${ADMIN_API_TOKEN}` },
|
||||
paramsSerializer: (p) => {
|
||||
return qs.stringify(p, { arrayFormat: "brackets" });
|
||||
@@ -84,12 +89,13 @@ class AdminApi {
|
||||
return res.data;
|
||||
}
|
||||
|
||||
async fetchMemberDataByToken(organizationMemberToken: string): Promise<AdminApiData> {
|
||||
async fetchMemberDataByToken(organizationMemberToken: string, playUri: string | null): Promise<AdminApiData> {
|
||||
if (!ADMIN_API_URL) {
|
||||
return Promise.reject(new Error("No admin backoffice set!"));
|
||||
}
|
||||
//todo: this call can fail if the corresponding world is not activated or if the token is invalid. Handle that case.
|
||||
const res = await Axios.get(ADMIN_API_URL + "/api/login-url/" + organizationMemberToken, {
|
||||
params: { playUri },
|
||||
headers: { Authorization: `${ADMIN_API_TOKEN}` },
|
||||
});
|
||||
if (!isAdminApiData(res.data)) {
|
||||
|
||||
Reference in New Issue
Block a user