Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Report granted permissions in the user-joined message #214

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MREUnityRuntime/MREUnityRuntimeLib/Core/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static IEnumerable<Permissions> ToEnumerable(this Permissions flags)
var aggregate = new List<Permissions>(allPerms.Length);
foreach (Permissions perm in allPerms)
{
if (flags.HasFlag(perm))
if ((flags & perm) != 0)
{
aggregate.Add(perm);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using MixedRealityExtension.Animation;
using MixedRealityExtension.API;
using MixedRealityExtension.Core;
using MixedRealityExtension.Core.Types;
using MixedRealityExtension.Messaging.Payloads.Converters;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;

namespace MixedRealityExtension.Patching.Types
{
Expand All @@ -22,6 +24,9 @@ public class UserPatch : Patchable<UserPatch>
[JsonConverter(typeof(UnsignedConverter))]
public UInt32? Groups { get; set; }

[PatchProperty]
public Permissions[] GrantedPermissions { get; set; }

public Dictionary<string, string> Properties { get; set; }

public UserPatch()
Expand All @@ -38,6 +43,8 @@ internal UserPatch(User user)
{
Name = user.Name;
Groups = user.Groups;
// the server doesn't need to care about the execution permission, it's assumed if you're connected
GrantedPermissions = user.App.GrantedPermissions.ToEnumerable().Where(p => p != Permissions.Execution).ToArray();
Properties = user.UserInfo.Properties;
}
}
Expand Down