mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-29 20:18:05 +01:00
commit
8332defb07
@ -1,5 +1,11 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/vmware/harbor/src/common/dao"
|
||||
"github.com/vmware/harbor/src/common/utils/log"
|
||||
"github.com/vmware/harbor/src/ui/config"
|
||||
)
|
||||
|
||||
// ProjectController handles requests to /project
|
||||
type ProjectController struct {
|
||||
BaseController
|
||||
@ -7,5 +13,12 @@ type ProjectController struct {
|
||||
|
||||
// Get renders project page
|
||||
func (pc *ProjectController) Get() {
|
||||
uid := pc.GetSession("userId")
|
||||
isSysAdmin, err := dao.IsAdminRole(uid)
|
||||
if err != nil {
|
||||
log.Warningf("Error in checking Admin Role for user, id: %d, error: %v", uid, err)
|
||||
isSysAdmin = false
|
||||
}
|
||||
pc.Data["CanCreate"] = !config.OnlyAdminCreateProject() || isSysAdmin
|
||||
pc.Forward("page_title_project", "project.htm")
|
||||
}
|
||||
|
@ -46,8 +46,10 @@
|
||||
<button class="btn btn-primary" type="button" ng-click="vm.searchProject()"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
{{ if eq .CanCreate true }}
|
||||
<button ng-if="vm.isOpen" class="btn btn-default" disabled="disabled" type="button"><span class="glyphicon glyphicon-plus"></span> // 'new_project' | tr //</button>
|
||||
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-show="vm.showAddButton()" ng-click="vm.showAddProject()"><span class="glyphicon glyphicon-plus"></span> // 'new_project' | tr //</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<add-project ng-show="vm.isOpen" is-open="vm.isOpen"></add-project>
|
||||
|
Loading…
Reference in New Issue
Block a user