Browse Source

增加判断是否课程页面的方法,前端使用

tags/v1.22.1.3^2
ychao_1983 3 years ago
parent
commit
0f523f1579
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      modules/context/context.go

+ 9
- 0
modules/context/context.go View File

@@ -65,6 +65,15 @@ func (ctx *Context) IsUserRepoAdmin() bool {
return ctx.Repo.IsAdmin()
}

func (ctx *Context) IsCourse() bool {
if ctx.Org != nil && ctx.Org.Organization != nil {
if ctx.Org.Organization.Name == setting.Course.OrgName {
return true
}
}
return false
}

// IsUserRepoWriter returns true if current user has write privilege in current repo
func (ctx *Context) IsUserRepoWriter(unitTypes []models.UnitType) bool {
for _, unitType := range unitTypes {


Loading…
Cancel
Save