mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-01 21:47:57 +01:00
commit
8332defb07
@ -1,5 +1,11 @@
|
|||||||
package controllers
|
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
|
// ProjectController handles requests to /project
|
||||||
type ProjectController struct {
|
type ProjectController struct {
|
||||||
BaseController
|
BaseController
|
||||||
@ -7,5 +13,12 @@ type ProjectController struct {
|
|||||||
|
|
||||||
// Get renders project page
|
// Get renders project page
|
||||||
func (pc *ProjectController) Get() {
|
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")
|
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>
|
<button class="btn btn-primary" type="button" ng-click="vm.searchProject()"><span class="glyphicon glyphicon-search"></span></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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-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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<add-project ng-show="vm.isOpen" is-open="vm.isOpen"></add-project>
|
<add-project ng-show="vm.isOpen" is-open="vm.isOpen"></add-project>
|
||||||
|
Loading…
Reference in New Issue
Block a user