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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -475,10 +475,9 @@ func GroupTestCard(account string, cardId string) (groupId string, err error) {
DataType: "imagroup", DataType: "imagroup",
Data: "group data with name and logo", 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 return
} }
SetBearerAuth(r, account)
AddGroup(w, r) AddGroup(w, r)
if err = ReadResponse(w, &group); err != nil { if err = ReadResponse(w, &group); err != nil {
return return