summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/models/access.go b/models/access.go
index 83261575e6..2c0900151f 100644
--- a/models/access.go
+++ b/models/access.go
@@ -7,6 +7,8 @@ package models
import (
"strings"
"time"
+
+ "github.com/lunny/xorm"
)
// Access types.
@@ -40,6 +42,15 @@ func UpdateAccess(access *Access) error {
return err
}
+// UpdateAccess updates access information with session for rolling back.
+func UpdateAccessWithSession(sess *xorm.Session, access *Access) error {
+ if _, err := sess.Id(access.Id).Update(access); err != nil {
+ sess.Rollback()
+ return err
+ }
+ return nil
+}
+
// HasAccess returns true if someone can read or write to given repository.
func HasAccess(userName, repoName string, mode int) (bool, error) {
return orm.Get(&Access{