pull/105/head
Apex Liu 2018-03-15 02:04:47 +08:00
parent 33eead9f05
commit e848c6ccbd
2 changed files with 17 additions and 5 deletions

View File

@ -471,6 +471,9 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
// int flag = SSH_LOG_FUNCTIONS; // int flag = SSH_LOG_FUNCTIONS;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_LOG_VERBOSITY, &flag); // ssh_options_set(_this->m_srv_session, SSH_OPTIONS_LOG_VERBOSITY, &flag);
#endif #endif
// int val = 0;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &val);
if (_this->m_auth_type != TP_AUTH_TYPE_NONE) if (_this->m_auth_type != TP_AUTH_TYPE_NONE)
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_USER, _this->m_acc_name.c_str()); ssh_options_set(_this->m_srv_session, SSH_OPTIONS_USER, _this->m_acc_name.c_str());
@ -479,10 +482,6 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
int _timeout = 30; // 30 sec. int _timeout = 30; // 30 sec.
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_TIMEOUT, &_timeout); ssh_options_set(_this->m_srv_session, SSH_OPTIONS_TIMEOUT, &_timeout);
// int val = 0;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &val);
int rc = 0; int rc = 0;
rc = ssh_connect(_this->m_srv_session); rc = ssh_connect(_this->m_srv_session);
if (rc != SSH_OK) { if (rc != SSH_OK) {

View File

@ -185,7 +185,20 @@ def update(handler, gid, name, desc):
def add_members(gtype, gid, members): def add_members(gtype, gid, members):
# 向指定组中增加成员,同时根据授权策略,更新授权映射表
db = get_db() db = get_db()
# 1. 获取与此组相关的运维授权策略
s = SQL(get_db())
s.select_from('ops_auz', ['id', 'policy_id', 'type', 'state'], alt_name='oa')
s.where('`rtype`={gtype} AND `gid`={gid}'.format(gtype=gtype, gid=gid))
err = s.query()
if err != TPE_OK:
return err
if s.total_count > 0:
pass
sql = [] sql = []
for uid in members: for uid in members:
sql.append('INSERT INTO `{}group_map` (`type`, `gid`, `mid`) VALUES ({}, {}, {});'.format(db.table_prefix, gtype, gid, uid)) sql.append('INSERT INTO `{}group_map` (`type`, `gid`, `mid`) VALUES ({}, {}, {});'.format(db.table_prefix, gtype, gid, uid))