using query param for access in alias module

This commit is contained in:
Roland Osborne 2022-03-20 14:25:46 -07:00
parent 487ba68eb1
commit 8c84971513
8 changed files with 38 additions and 18 deletions

View File

@ -831,8 +831,13 @@ paths:
- alias
description: Get groups for sharing. Access granted to app tokens of the account holder.
operationId: get-groups
security:
- bearerAuth: []
parameters:
- name: agent
in: query
description: agent token
required: false
schema:
type: string
responses:
'200':
description: successful operation
@ -859,8 +864,13 @@ paths:
- alias
description: Add a group for sharing. Access granted to app tokens of account holder.
operationId: add-group
security:
- bearerAuth: []
parameters:
- name: agent
in: query
description: agent token
required: false
schema:
type: string
responses:
'200':
description: success
@ -886,8 +896,6 @@ paths:
- alias
description: Base64 decode and download specified field from the groups's subject. Access granted to app token of account holder.
operationId: get-group-subject-field
security:
- bearerAuth: []
parameters:
- name: groupId
in: path
@ -901,6 +909,12 @@ paths:
required: true
schema:
type: string
- name: agent
in: query
description: agent token
required: false
schema:
type: string
responses:
'200':
description: success
@ -926,8 +940,6 @@ paths:
- alias
description: Update group description for sharing. Access granted to app tokens of account holder.
operationId: set-group-subject
security:
- bearerAuth: []
parameters:
- name: groupId
in: path
@ -935,6 +947,12 @@ paths:
required: true
schema:
type: string
- name: agent
in: query
description: agent token
required: false
schema:
type: string
responses:
'200':
description: success
@ -960,8 +978,6 @@ paths:
- alias
description: Remove sharing group
operationId: remove-group
security:
- bearerAuth: []
parameters:
- name: groupId
in: path
@ -969,6 +985,12 @@ paths:
required: true
schema:
type: string
- name: agent
in: query
description: agent token
required: false
schema:
type: string
responses:
'200':
description: success

View File

@ -9,7 +9,7 @@ import (
func AddGroup(w http.ResponseWriter, r *http.Request) {
account, code, err := BearerAppToken(r, false)
account, code, err := ParamAgentToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return

View File

@ -21,7 +21,7 @@ func GetGroupSubjectField(w http.ResponseWriter, r *http.Request) {
field := params["field"]
elements := strings.Split(field, ".")
account, code, err := BearerAppToken(r, false);
account, code, err := ParamAgentToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return

View File

@ -10,7 +10,7 @@ func GetGroups(w http.ResponseWriter, r *http.Request) {
var groupRevisionSet bool
var groupRevision int64
account, code, err := BearerAppToken(r, false);
account, code, err := ParamAgentToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return

View File

@ -8,7 +8,6 @@ func GetProfile(w http.ResponseWriter, r *http.Request) {
account, code, err := ParamAgentToken(r, true);
if err != nil {
PrintMsg(r);
ErrResponse(w, code, err)
return
}

View File

@ -10,7 +10,7 @@ import (
func RemoveGroup(w http.ResponseWriter, r *http.Request) {
account, code, err := BearerAppToken(r, false);
account, code, err := ParamAgentToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return

View File

@ -10,7 +10,7 @@ import (
func SetGroupSubject(w http.ResponseWriter, r *http.Request) {
account, code, err := BearerAppToken(r, false);
account, code, err := ParamAgentToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return

View File

@ -475,10 +475,9 @@ func GroupTestCard(account string, cardId string) (groupId string, err error) {
DataType: "imagroup",
Data: "group data with name and logo",
}
if r, w, err = NewRequest("POST", "/share/groups", subject); err != nil {
if r, w, err = NewRequest("POST", "/share/groups?agent=" + account, subject); err != nil {
return
}
SetBearerAuth(r, account)
AddGroup(w, r)
if err = ReadResponse(w, &group); err != nil {
return