no message
This commit is contained in:
@@ -2,9 +2,9 @@ package _VisualDVM.ComponentsServer.UserAccount.UI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
public class UserAccountDialog extends DBObjectDialog<UserAccount, UserAccountFields> {
|
||||
public UserAccountDialog() {
|
||||
super(UserAccountFields.class);
|
||||
|
||||
@@ -6,11 +6,11 @@ import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class UserAccountFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JTextField tfName;
|
||||
public JTextField tfAddress;
|
||||
public JCheckBox cbMail;
|
||||
public JComboBox cbRole;
|
||||
private JPanel content;
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
|
||||
@@ -13,38 +13,37 @@ public class UserAccount extends iDBObject {
|
||||
public String name = "";
|
||||
public String email = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String telegram_name="";
|
||||
public String telegram_name = "";
|
||||
@Description("DEFAULT 1")
|
||||
public int subscribe_active = 1;
|
||||
@Description("DEFAULT 'Undefined'")
|
||||
public AccountRole role = AccountRole.Undefined; //права доступа
|
||||
public UserAccount(){
|
||||
|
||||
public UserAccount() {
|
||||
}
|
||||
public UserAccount(UserAccount account_in) {
|
||||
this.SynchronizeFields(account_in);
|
||||
}
|
||||
public UserAccount(String name_in, String email_in) {
|
||||
name = name_in;
|
||||
email = email_in;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
UserAccount src_ = (UserAccount) src;
|
||||
name = src_.name;
|
||||
email = src_.email;
|
||||
telegram_name=src_.telegram_name;
|
||||
subscribe_active=src_.subscribe_active;
|
||||
telegram_name = src_.telegram_name;
|
||||
subscribe_active = src_.subscribe_active;
|
||||
role = src_.role;
|
||||
}
|
||||
public UserAccount(String name_in, String email_in){
|
||||
name = name_in;
|
||||
email=email_in;
|
||||
public File getClientKeyFile() {
|
||||
return new File(Global.KeysDirectory, "key");
|
||||
}
|
||||
public File getClientKeyFile(){
|
||||
return new File(Global.KeysDirectory,"key");
|
||||
public File getServerKeyFile() {
|
||||
return new File(Global.KeysDirectory, String.valueOf(id));
|
||||
}
|
||||
public File getServerKeyFile(){
|
||||
return new File(Global.KeysDirectory,String.valueOf(id));
|
||||
}
|
||||
public String getKey() throws Exception{
|
||||
public String getKey() throws Exception {
|
||||
return FileUtils.readFileToString(getServerKeyFile());
|
||||
}
|
||||
public void generateKey() throws Exception {
|
||||
|
||||
@@ -11,7 +11,6 @@ import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountsJson;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UI.UserAccountsForm;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -20,15 +19,15 @@ public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
public UserAccountsDBTable() {
|
||||
super(UserAccount.class);
|
||||
}
|
||||
public UserAccount getByKey(String key_in) throws Exception{
|
||||
for (UserAccount userAccount: Data.values()){
|
||||
public UserAccount getByKey(String key_in) throws Exception {
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if (userAccount.getKey().equals(key_in))
|
||||
return userAccount;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public UserAccount getByEmail(String email_in){
|
||||
for (UserAccount userAccount: Data.values()){
|
||||
public UserAccount getByEmail(String email_in) {
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if (userAccount.email.equals(email_in))
|
||||
return userAccount;
|
||||
}
|
||||
@@ -53,22 +52,21 @@ public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
res.put(SubscriberWorkspace.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
return res;
|
||||
}
|
||||
public String getPackedActiveRecipients(){
|
||||
UserAccountsJson res = new UserAccountsJson();
|
||||
public String getPackedActiveRecipients() {
|
||||
UserAccountsJson res = new UserAccountsJson();
|
||||
Vector<String> active = new Vector<>();
|
||||
for (UserAccount userAccount: Data.values()){
|
||||
if ((userAccount.subscribe_active!=0) && !active.contains(userAccount.email)){
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if ((userAccount.subscribe_active != 0) && !active.contains(userAccount.email)) {
|
||||
active.add(userAccount.email);
|
||||
res.values.add(new UserAccountJson(userAccount.email, userAccount.name));
|
||||
}
|
||||
}
|
||||
return Utils_.gson.toJson(res);
|
||||
}
|
||||
|
||||
public Vector<String> getActiveMails(){
|
||||
public Vector<String> getActiveMails() {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (UserAccount account: Data.values()){
|
||||
if ((account.subscribe_active!=0)&& !res.contains(account.email))
|
||||
for (UserAccount account : Data.values()) {
|
||||
if ((account.subscribe_active != 0) && !res.contains(account.email))
|
||||
res.add(account.email);
|
||||
}
|
||||
for (String admin_mail : Constants.admins_mails) {
|
||||
|
||||
Reference in New Issue
Block a user