Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpcs
dfss
Commits
17e397b4
Commit
17e397b4
authored
May 25, 2016
by
Richer Maximilien
Browse files
[p] Platform handler
parent
45cd0c5c
Pipeline
#2190
passed with stage
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
dfssp/server/server.go
View file @
17e397b4
...
...
@@ -43,8 +43,7 @@ func (s *platformServer) Auth(ctx context.Context, in *api.AuthRequest) (*api.Re
//
// Handle incoming UnregisterRequest messages
func
(
s
*
platformServer
)
Unregister
(
ctx
context
.
Context
,
in
*
api
.
Empty
)
(
*
api
.
ErrorCode
,
error
)
{
// TODO
return
nil
,
nil
return
user
.
Unregister
(
s
.
DB
,
net
.
GetClientHash
(
&
ctx
)),
nil
}
// PostContract handler
...
...
dfssp/user/delete.go
0 → 100644
View file @
17e397b4
package
user
import
(
api
"dfss/dfssp/api"
"dfss/mgdb"
"gopkg.in/mgo.v2/bson"
)
// Unregister delete a user based on the provided certificate hash
func
Unregister
(
manager
*
mgdb
.
MongoManager
,
userCertificateHash
[]
byte
)
*
api
.
ErrorCode
{
count
,
err
:=
manager
.
Get
(
"users"
)
.
DeleteAll
(
bson
.
M
{
"certHash"
:
bson
.
M
{
"$eq"
:
userCertificateHash
},
})
if
err
!=
nil
||
count
==
0
{
return
&
api
.
ErrorCode
{
Code
:
api
.
ErrorCode_INVARG
,
Message
:
"No user matching provided certificate"
}
}
return
&
api
.
ErrorCode
{
Code
:
api
.
ErrorCode_SUCCESS
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment