update readme and workspaces for scoped tokens
This commit is contained in:
parent
a6a2d03dac
commit
9780b8e6cd
3 changed files with 80 additions and 47 deletions
|
|
@ -31,7 +31,7 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Post, "/FetchNextNotecard/{token}")]
|
[Route(HttpVerbs.Post, "/FetchNextNotecard/{token}")]
|
||||||
public object FetchNextNotecard([FormField] string endpoint, [FormField] string endpointcode, string 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");
|
return Failure("Token not accepted");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ namespace BetterSecondBot.HttpService
|
||||||
bool found = true;
|
bool found = true;
|
||||||
while (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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -343,7 +343,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
scopedTokenInfo info = scopedtokens[code];
|
scopedTokenInfo info = scopedtokens[code];
|
||||||
string build = workgroup + "/" + command;
|
string build = workgroup + "/" + command;
|
||||||
if (info.AllowWorkgroups.Contains(workgroup) == true)
|
if ((info.AllowWorkgroups.Contains(workgroup) == true) || (info.AllowWorkgroups.Contains("+ALL") == true))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -512,31 +512,39 @@ namespace BetterSecondBot.HttpService
|
||||||
if (permsgroupname == "chat")
|
if (permsgroupname == "chat")
|
||||||
{
|
{
|
||||||
allowed = new List<string>(){
|
allowed = new List<string>(){
|
||||||
"chat/localchathistory",
|
"chat/IM",
|
||||||
"chat/localchatsay",
|
"chat/LocalChatHistory",
|
||||||
"groups/getgroupchat",
|
"chat/Say",
|
||||||
"groups/sendgroupchat",
|
"group/Groupchat",
|
||||||
"groups/listgroups",
|
"group/GetGroupList",
|
||||||
"im/chatwindows",
|
"group/GroupchatListAllUnreadGroups",
|
||||||
"im/listwithunread",
|
|
||||||
"im/getimchat",
|
"im/getimchat",
|
||||||
"im/sendimchat"
|
"im/chatwindows",
|
||||||
|
"im/haveunreadims",
|
||||||
|
"im/listwithunread"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (permsgroupname == "giver")
|
else if (permsgroupname == "giver")
|
||||||
{
|
{
|
||||||
allowed = new List<string>(){
|
allowed = new List<string>(){
|
||||||
"inventory/send",
|
"inventory/SendItem",
|
||||||
"inventory/folders",
|
"inventory/SendFolder",
|
||||||
"inventory/contents"
|
"inventory/InventoryFolders",
|
||||||
|
"inventory/InventoryContents"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (permsgroupname == "movement")
|
else if (permsgroupname == "movement")
|
||||||
{
|
{
|
||||||
allowed = new List<string>(){
|
allowed = new List<string>(){
|
||||||
"core/walkto",
|
"movement/AutoPilot",
|
||||||
"core/teleport",
|
"movement/AutoPilotStop",
|
||||||
"core/gesture"
|
"movement/Fly",
|
||||||
|
"movement/RequestTeleport",
|
||||||
|
"movement/RotateTo",
|
||||||
|
"movement/RotateToFace",
|
||||||
|
"movement/RotateToFaceVector",
|
||||||
|
"movement/SendTeleportLure",
|
||||||
|
"movement/Teleport",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return allowed.Contains(build);
|
return allowed.Contains(build);
|
||||||
|
|
|
||||||
73
README.md
73
README.md
|
|
@ -109,44 +109,69 @@ You get set these tokens up by file or Environment Variables.
|
||||||
##### Environment Variables
|
##### Environment Variables
|
||||||
|Name | Value|
|
|Name | Value|
|
||||||
|--|--|
|
|--|--|
|
||||||
| scoped_token_1 | "t:[10charcode],ws:core,ws:group" |
|
| ScopedToken1 | "t:[10charcode],ws:core,ws:group" |
|
||||||
| scoped_token_2 | "t:[10charcode],cg:chat" |
|
| ScopedToken2 | "t:[10charcode],cg:chat" |
|
||||||
| scoped_token_3 | "t:[10charcode],cm:chat/localchathistory" |
|
| ScopedToken3 | "t:[10charcode],cm:chat/LocalChatHistory" |
|
||||||
|
|
||||||
|
|
||||||
### HTTP scoped tokens (info)
|
### 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`"
|
commandgroups [cg] "example: `cg:chat`"
|
||||||
chat
|
chat
|
||||||
chat/localchathistory
|
chat/IM
|
||||||
chat/localchatsay
|
chat/LocalChatHistory
|
||||||
groups/getgroupchat
|
chat/Say
|
||||||
groups/sendgroupchat
|
group/Groupchat
|
||||||
groups/listgroups
|
group/GetGroupList
|
||||||
im/chatwindows
|
group/GroupchatListAllUnreadGroups
|
||||||
im/listwithunread
|
|
||||||
im/getimchat
|
im/getimchat
|
||||||
im/sendimchat
|
im/chatwindows
|
||||||
|
im/haveunreadims
|
||||||
|
im/listwithunread
|
||||||
|
|
||||||
giver
|
giver
|
||||||
inventory/send
|
inventory/SendItem
|
||||||
inventory/folders
|
inventory/SendFolder
|
||||||
inventory/contents
|
inventory/InventoryFolders
|
||||||
|
inventory/InventoryContents
|
||||||
|
|
||||||
groupinvite
|
|
||||||
[WIP]
|
|
||||||
|
|
||||||
movement
|
movement
|
||||||
core/walkto
|
movement/AutoPilot
|
||||||
core/teleport
|
movement/AutoPilotStop
|
||||||
core/gesture
|
movement/Fly
|
||||||
|
movement/RequestTeleport
|
||||||
|
movement/RotateTo
|
||||||
|
movement/RotateToFace
|
||||||
|
movement/RotateToFaceVector
|
||||||
|
movement/SendTeleportLure
|
||||||
|
movement/Teleport
|
||||||
|
|
||||||
|
|
||||||
### BetterRelay system
|
### BetterRelay system
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue