瀏覽代碼

allow installation of a key on a sage if there are no keys defined

tags/v1.1.1
Jonathan Cobb 4 年之前
父節點
當前提交
15dd33366a
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      bubble-server/src/main/java/bubble/dao/account/AccountSshKeyDAO.java

+ 7
- 2
bubble-server/src/main/java/bubble/dao/account/AccountSshKeyDAO.java 查看文件

@@ -48,8 +48,13 @@ public class AccountSshKeyDAO extends AccountOwnedEntityDAO<AccountSshKey> {
final Account owner = accountDAO.findByUuid(key.getAccount());
final BubbleNetwork thisNetwork = configuration.getThisNetwork();
if (thisNetwork == null || thisNetwork.getInstallType() == AnsibleInstallType.sage) {
// never allow installation of a key on sage. must be manually set in the database.
key.setInstallSshKey(false);
// only allow installation of a key on a sage if the user is the first admin and has no keys
final Account firstAdmin = accountDAO.getFirstAdmin();
if (owner.getUuid().equals(firstAdmin.getUuid())) {
key.setInstallSshKey(findByAccount(owner.getUuid()).size() == 0);
} else {
key.setInstallSshKey(false);
}

} else {
// admin keys are always installed on a node


Loading…
取消
儲存