Added binding to tokens api and role validation
This commit is contained in:
@@ -19,12 +19,8 @@ const (
|
||||
ROLE_ADMIN RoleType = "Admin"
|
||||
)
|
||||
|
||||
func (r RoleType) Validate() error {
|
||||
if r == ROLE_OWNER || r == ROLE_VIEWER || r == ROLE_ADMIN || r == ROLE_EDITOR {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ErrInvalidRoleType
|
||||
func (r RoleType) IsValid() bool {
|
||||
return r == ROLE_VIEWER || r == ROLE_ADMIN || r == ROLE_EDITOR
|
||||
}
|
||||
|
||||
type Collaborator struct {
|
||||
|
||||
+6
-5
@@ -25,11 +25,12 @@ type AddTokenCommand struct {
|
||||
}
|
||||
|
||||
type UpdateTokenCommand struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AccountId int64 `json:"-"`
|
||||
Role RoleType `json:"role"`
|
||||
Result *Token `json:"-"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Role RoleType `json:"role"`
|
||||
|
||||
AccountId int64 `json:"-"`
|
||||
Result *Token `json:"-"`
|
||||
}
|
||||
|
||||
type DeleteTokenCommand struct {
|
||||
|
||||
Reference in New Issue
Block a user