Implemented Create and Update methods on list
This commit is contained in:
@ -11,6 +11,9 @@ type Namespace struct {
|
||||
|
||||
Created int64 `xorm:"created" json:"created"`
|
||||
Updated int64 `xorm:"updated" json:"updated"`
|
||||
|
||||
CRUDable `xorm:"-" json:"-"`
|
||||
Rights `xorm:"-" json:"-"`
|
||||
}
|
||||
|
||||
// TableName makes beautiful table names
|
||||
@ -58,6 +61,14 @@ func (user *User) HasNamespaceAccess(namespace *Namespace) (err error) {
|
||||
return ErrUserDoesNotHaveAccessToNamespace{UserID: user.ID, NamespaceID: namespace.ID}
|
||||
}
|
||||
|
||||
func (n *Namespace) CanWrite(user *User) bool {
|
||||
if err := user.HasNamespaceAccess(n); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (user *User) HasNamespaceWriteAccess(namespace *Namespace) (err error) {
|
||||
|
||||
// Owners always have access
|
||||
|
Reference in New Issue
Block a user