harbor
  • Introduction
  • 安装
  • API
  • harbor数据库
  • 镜像与源码项目
  • UI
    • user
      • GET_/users
    • Router
    • Controller-API
      • user
      • project
      • member
      • repository
      • base.go
  • JobService
  • secretkey
  • 日志
Powered by GitBook
On this page
  • 结构体及函数
  • ValidateUser()

Was this helpful?

  1. UI
  2. Controller-API

base.go

结构体及函数

下面给出了BaseAPI的结构体定义及主要成员函数

type BaseAPI struct {
    beego.Controller
}

func (b *BaseAPI) ValidateUser() int { }

func (b *BaseAPI) GetUserIDForRequest() (int, bool, bool) { }

ValidateUser()

  • 描述:该函数用来验证该请求是否是由一个有效的用户发起

  • 返回值:Header中用户名对应的ID

代码如下:

第(2)行代码中有三个返回值:

  • userID:请求中解析出来的用户ID,可能来自basic,也可能来自session

  • needsCheck:如果为true,表明userID来自session;否则来自basic

  • ok:表示获取userID失败

PreviousrepositoryNextJobService

Last updated 4 years ago

Was this helpful?