public DlgUser(EA.Repository rep) { var sql = new UtilSql(rep); InitializeComponent(); if (rep.IsSecurityEnabled) { _isSecurityEnabled = true; // check if user has the rights to manage users if (sql.UserHasPermission(rep.GetCurrentLoginUser(true), 1)) { _users = sql.GetUsers(); txtStatus.Text = "Security is enabled: Choose user"; } else { txtStatus.Text = "Security is enabled: Only person with 'Manage User' are allowed to change users!"; MessageBox.Show("User has no 'Manage Users' right", "Insufficient user rights"); btnOk.Enabled = false; } } else { _users = sql.GetUsers(); txtStatus.Text = "Security isn't enabled: Choose or enter your desired author name!"; } cmbUser.Text = _user; cmbUser.DataSource = _users; }
/// <summary> /// Dialog to ask and enter a user. Enter a user is only possible if the user has the rights. /// </summary> /// <param name="rep"></param> /// <param name="changeScope"></param> /// <param name="lToDelete"></param> public DlgAuthor(Repository rep, ChangeScope changeScope, List <string> lToDelete) { _rep = rep; var sql = new UtilSql(rep); InitializeComponent(); _listChanged.DataSource = lToDelete; switch (changeScope) { case ChangeScope.Item: Text = _items; break; case ChangeScope.Package: Text = _packages; break; case ChangeScope.PackageRecursive: Text = _packagesRecursive; break; } if (rep.IsSecurityEnabled) { _isSecurityEnabled = true; // check if user has the rights to manage users if (sql.UserHasPermission(rep.GetCurrentLoginUser(true))) { _users = sql.GetUsers(); txtStatus.Text = "Security is enabled: Choose user"; } else { txtStatus.Text = "Security is enabled: Only person with 'Manage User' are allowed to change users!"; MessageBox.Show("User has no 'Manage Users' right", "Insufficient user rights"); btnOk.Enabled = false; } } else { _users = sql.GetUsers(); txtStatus.Text = "Security isn't enabled: Choose or enter your desired author name!"; } cmbUser.Text = _user; cmbUser.DataSource = _users; }