summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/models/access.go b/models/access.go
index 34d76953f5..3cdfc62f21 100644
--- a/models/access.go
+++ b/models/access.go
@@ -1,10 +1,15 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package models
-import "fmt"
+import (
+ "fmt"
+
+ "code.gitea.io/gitea/modules/log"
+)
// AccessMode specifies the users access mode
type AccessMode int
@@ -37,6 +42,13 @@ func (mode AccessMode) String() string {
}
}
+// ColorFormat provides a ColorFormatted version of this AccessMode
+func (mode AccessMode) ColorFormat(s fmt.State) {
+ log.ColorFprintf(s, "%d:%s",
+ log.NewColoredIDValue(mode),
+ mode)
+}
+
// ParseAccessMode returns corresponding access mode to given permission string.
func ParseAccessMode(permission string) AccessMode {
switch permission {