mirror of https://github.com/portainer/portainer
22 lines
473 B
Go
22 lines
473 B
Go
package role
|
|
|
|
import (
|
|
portainer "github.com/portainer/portainer/api"
|
|
"github.com/portainer/portainer/api/dataservices"
|
|
)
|
|
|
|
type ServiceTx struct {
|
|
dataservices.BaseDataServiceTx[portainer.Role, portainer.RoleID]
|
|
}
|
|
|
|
// CreateRole creates a new Role.
|
|
func (service ServiceTx) Create(role *portainer.Role) error {
|
|
return service.Tx.CreateObject(
|
|
BucketName,
|
|
func(id uint64) (int, interface{}) {
|
|
role.ID = portainer.RoleID(id)
|
|
return int(role.ID), role
|
|
},
|
|
)
|
|
}
|