update readme and workspaces for scoped tokens

This commit is contained in:
Madpeterz 2021-02-21 01:04:43 +00:00
parent a6a2d03dac
commit 9780b8e6cd
3 changed files with 80 additions and 47 deletions

View file

@ -31,7 +31,7 @@ namespace BetterSecondBot.HttpService
[Route(HttpVerbs.Post, "/FetchNextNotecard/{token}")]
public object FetchNextNotecard([FormField] string endpoint, [FormField] string endpointcode, string token)
{
if (tokens.Allow(token, "avatars", "FetchNextNotecard", handleGetClientIP()) == false)
if (tokens.Allow(token, "streamadmin", "FetchNextNotecard", handleGetClientIP()) == false)
{
return Failure("Token not accepted");
}

View file

@ -35,9 +35,9 @@ namespace BetterSecondBot.HttpService
bool found = true;
while (found == true)
{
if (helpers.notempty(Environment.GetEnvironmentVariable("scoped_token_" + loop.ToString())) == true)
if (helpers.notempty(Environment.GetEnvironmentVariable("ScopedToken" + loop.ToString())) == true)
{
processScopedTokenRaw(Environment.GetEnvironmentVariable("scoped_token_" + loop.ToString()));
processScopedTokenRaw(Environment.GetEnvironmentVariable("ScopedToken" + loop.ToString()));
}
else
{
@ -343,7 +343,7 @@ namespace BetterSecondBot.HttpService
}
scopedTokenInfo info = scopedtokens[code];
string build = workgroup + "/" + command;
if (info.AllowWorkgroups.Contains(workgroup) == true)
if ((info.AllowWorkgroups.Contains(workgroup) == true) || (info.AllowWorkgroups.Contains("+ALL") == true))
{
return true;
}
@ -512,31 +512,39 @@ namespace BetterSecondBot.HttpService
if (permsgroupname == "chat")
{
allowed = new List<string>(){
"chat/localchathistory",
"chat/localchatsay",
"groups/getgroupchat",
"groups/sendgroupchat",
"groups/listgroups",
"im/chatwindows",
"im/listwithunread",
"chat/IM",
"chat/LocalChatHistory",
"chat/Say",
"group/Groupchat",
"group/GetGroupList",
"group/GroupchatListAllUnreadGroups",
"im/getimchat",
"im/sendimchat"
"im/chatwindows",
"im/haveunreadims",
"im/listwithunread"
};
}
else if (permsgroupname == "giver")
{
allowed = new List<string>(){
"inventory/send",
"inventory/folders",
"inventory/contents"
"inventory/SendItem",
"inventory/SendFolder",
"inventory/InventoryFolders",
"inventory/InventoryContents"
};
}
else if (permsgroupname == "movement")
{
allowed = new List<string>(){
"core/walkto",
"core/teleport",
"core/gesture"
"movement/AutoPilot",
"movement/AutoPilotStop",
"movement/Fly",
"movement/RequestTeleport",
"movement/RotateTo",
"movement/RotateToFace",
"movement/RotateToFaceVector",
"movement/SendTeleportLure",
"movement/Teleport",
};
}
return allowed.Contains(build);

View file

@ -109,44 +109,69 @@ You get set these tokens up by file or Environment Variables.
##### Environment Variables
|Name | Value|
|--|--|
| scoped_token_1 | "t:[10charcode],ws:core,ws:group" |
| scoped_token_2 | "t:[10charcode],cg:chat" |
| scoped_token_3 | "t:[10charcode],cm:chat/localchathistory" |
| ScopedToken1 | "t:[10charcode],ws:core,ws:group" |
| ScopedToken2 | "t:[10charcode],cg:chat" |
| ScopedToken3 | "t:[10charcode],cm:chat/LocalChatHistory" |
### HTTP scoped tokens (info)
---
command [cm] "example: `cm:chat/localchathistory`
command [cm] "example: `cm:chat/LocalChatHistory`
"a single command, formated as cm:[workspace]/[commandname]"
workspaces [ws] "example: ws: core, ws: groups"
workspaces [ws] "example: ws: core, ws: group"
"all commands under a workspace"
"known workspaces"
animation
avatars
chat
core
dialogs
estate
friends
group
home
im
info
inventory
movement
notecard
parcel
self
streamadmin
+ALL
commandgroups [cg] "example: `cg:chat`"
chat
chat/localchathistory
chat/localchatsay
groups/getgroupchat
groups/sendgroupchat
groups/listgroups
im/chatwindows
im/listwithunread
im/getimchat
im/sendimchat
giver
inventory/send
inventory/folders
inventory/contents
groupinvite
[WIP]
movement
core/walkto
core/teleport
core/gesture
chat
chat/IM
chat/LocalChatHistory
chat/Say
group/Groupchat
group/GetGroupList
group/GroupchatListAllUnreadGroups
im/getimchat
im/chatwindows
im/haveunreadims
im/listwithunread
giver
inventory/SendItem
inventory/SendFolder
inventory/InventoryFolders
inventory/InventoryContents
movement
movement/AutoPilot
movement/AutoPilotStop
movement/Fly
movement/RequestTeleport
movement/RotateTo
movement/RotateToFace
movement/RotateToFaceVector
movement/SendTeleportLure
movement/Teleport
### BetterRelay system