Update APIs, Formatting
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
41b3e20aff
commit
d66beb95e5
|
@ -37,10 +37,10 @@ func TestContactRetryQueue(t *testing.T) {
|
||||||
setup := false
|
setup := false
|
||||||
for !setup {
|
for !setup {
|
||||||
if _, exists := cr.connections.Load(testOnion); exists {
|
if _, exists := cr.connections.Load(testOnion); exists {
|
||||||
if _, exists := cr.authorizedPeers.Load(testOnion); exists {
|
if _, exists := cr.authorizedPeers.Load(testOnion); exists {
|
||||||
t.Logf("authorized")
|
t.Logf("authorized")
|
||||||
setup = true
|
setup = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -718,17 +718,8 @@ func (cp *cwtchPeer) UpdateConversationAccessControlList(id int, acl model.Acces
|
||||||
return cp.storage.SetConversationACL(id, acl)
|
return cp.storage.SetConversationACL(id, acl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnhancedGetConversationAccessControlList serialzies the access control list associated with the conversation
|
// EnhancedUpdateConversationAccessControlList wraps UpdateConversationAccessControlList and allows updating via a serialized JSON struct
|
||||||
func (cp *cwtchPeer) EnhancedGetConversationAccessControlList(id int) (string, error) {
|
func (cp *cwtchPeer) EnhancedUpdateConversationAccessControlList(id int, json string) error {
|
||||||
ci, err := cp.GetConversationInfo(id)
|
|
||||||
if err == nil {
|
|
||||||
return string(ci.ACL.Serialize()), nil
|
|
||||||
}
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateConversationAccessControlListJSON wraps UpdateConversationAccessControlList and allows updating via a serialized JSON struct
|
|
||||||
func (cp *cwtchPeer) UpdateConversationAccessControlListJSON(id int, json string) error {
|
|
||||||
_, err := cp.GetConversationInfo(id)
|
_, err := cp.GetConversationInfo(id)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
acl, err := model.DeserializeAccessControlList([]byte(json))
|
acl, err := model.DeserializeAccessControlList([]byte(json))
|
||||||
|
@ -740,6 +731,24 @@ func (cp *cwtchPeer) UpdateConversationAccessControlListJSON(id int, json string
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConversationAccessControlList returns the access control list associated with the conversation
|
||||||
|
func (cp *cwtchPeer) GetConversationAccessControlList(id int) (model.AccessControlList, error) {
|
||||||
|
ci, err := cp.GetConversationInfo(id)
|
||||||
|
if err == nil {
|
||||||
|
return ci.ACL, nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnhancedGetConversationAccessControlList serialzies the access control list associated with the conversation
|
||||||
|
func (cp *cwtchPeer) EnhancedGetConversationAccessControlList(id int) (string, error) {
|
||||||
|
ci, err := cp.GetConversationInfo(id)
|
||||||
|
if err == nil {
|
||||||
|
return string(ci.ACL.Serialize()), nil
|
||||||
|
}
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
// AcceptConversation looks up a conversation by `handle` and sets the Accepted status to `true`
|
// AcceptConversation looks up a conversation by `handle` and sets the Accepted status to `true`
|
||||||
// This will cause Cwtch to auto connect to this conversation on start up
|
// This will cause Cwtch to auto connect to this conversation on start up
|
||||||
func (cp *cwtchPeer) AcceptConversation(id int) error {
|
func (cp *cwtchPeer) AcceptConversation(id int) error {
|
||||||
|
|
|
@ -123,8 +123,10 @@ type CwtchPeer interface {
|
||||||
|
|
||||||
// API-level management of conversation access control
|
// API-level management of conversation access control
|
||||||
UpdateConversationAccessControlList(id int, acl model.AccessControlList) error
|
UpdateConversationAccessControlList(id int, acl model.AccessControlList) error
|
||||||
|
EnhancedUpdateConversationAccessControlList(conversation int, acjson string) error
|
||||||
|
|
||||||
|
GetConversationAccessControlList(conversation int) (model.AccessControlList, error)
|
||||||
EnhancedGetConversationAccessControlList(conversation int) (string, error)
|
EnhancedGetConversationAccessControlList(conversation int) (string, error)
|
||||||
UpdateConversationAccessControlListJSON(conversation int, acjson string) error
|
|
||||||
|
|
||||||
// Convieniance Functions for ACL Management
|
// Convieniance Functions for ACL Management
|
||||||
AcceptConversation(conversation int) error
|
AcceptConversation(conversation int) error
|
||||||
|
|
Loading…
Reference in New Issue