Organization: You can now update the organization user role directly (without removing and readding the organization user). Closes #1899

This commit is contained in:
Torkel Ödegaard
2015-05-01 09:48:07 +02:00
parent b48b11e902
commit e771d8e944
9 changed files with 74 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import (
var (
ErrInvalidRoleType = errors.New("Invalid role type")
ErrLastOrgAdmin = errors.New("Cannot remove last organization admin")
ErrOrgUserNotFound = errors.New("Cannot find the organization user")
)
type RoleType string
@@ -24,6 +25,7 @@ func (r RoleType) IsValid() bool {
}
type OrgUser struct {
Id int64
OrgId int64
UserId int64
Role RoleType
@@ -47,6 +49,13 @@ type AddOrgUserCommand struct {
UserId int64 `json:"-"`
}
type UpdateOrgUserCommand struct {
Role RoleType `json:"role" binding:"Required"`
OrgId int64 `json:"-"`
UserId int64 `json:"-"`
}
// ----------------------
// QUERIES