AdminDeleteDB() private method

private AdminDeleteDB ( string projectName ) : int
projectName string
return int
Esempio n. 1
0
        public static bool Testing_SetupDatabase(string host, int port, string adminUser, string adminPwd, string user, string pwd, string projectName)
        {
            AssetServer.AdminSetCredentials(host, port, adminUser, adminPwd);
            MaintDatabaseRecord[] recordArray = AssetServer.AdminRefreshDatabases();
            if (recordArray == null)
            {
                return(false);
            }
            foreach (MaintDatabaseRecord record in recordArray)
            {
                if (record.name == projectName)
                {
                    AssetServer.AdminDeleteDB(projectName);
                }
            }
            if (AssetServer.AdminCreateDB(projectName) == 0)
            {
                return(false);
            }
            string databaseName = AssetServer.GetDatabaseName(host, adminUser, adminPwd, port.ToString(), projectName);

            if (!AssetServer.AdminSetUserEnabled(databaseName, user, user, string.Empty, 1))
            {
                return(false);
            }
            Testing_SetActiveDatabase(host, port, projectName, databaseName, user, pwd);
            return(true);
        }
Esempio n. 2
0
        public static bool Testing_SetupDatabase(string host, int port, string adminUser, string adminPwd, string user, string pwd, string projectName)
        {
            AssetServer.AdminSetCredentials(host, port, adminUser, adminPwd);
            MaintDatabaseRecord[] array = AssetServer.AdminRefreshDatabases();
            if (array == null)
            {
                return(false);
            }
            MaintDatabaseRecord[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                MaintDatabaseRecord maintDatabaseRecord = array2[i];
                if (maintDatabaseRecord.name == projectName)
                {
                    AssetServer.AdminDeleteDB(projectName);
                }
            }
            if (AssetServer.AdminCreateDB(projectName) == 0)
            {
                return(false);
            }
            string databaseName = AssetServer.GetDatabaseName(host, adminUser, adminPwd, port.ToString(), projectName);

            if (!AssetServer.AdminSetUserEnabled(databaseName, user, user, string.Empty, 1))
            {
                return(false);
            }
            ASEditorBackend.Testing_SetActiveDatabase(host, port, projectName, databaseName, user, pwd);
            return(true);
        }
Esempio n. 3
0
        private void ActionBox()
        {
            bool enabled = GUI.enabled;

            switch (this.currAction)
            {
            case ASServerAdminWindow.Action.Main:
                if (!this.isConnected)
                {
                    GUI.enabled = false;
                }
                if (this.WordWrappedLabelButton("Want to create a new project?", "Create"))
                {
                    this.nProjectName         = string.Empty;
                    this.nTemplateProjectName = string.Empty;
                    this.currAction           = ASServerAdminWindow.Action.CreateProject;
                }
                if (this.WordWrappedLabelButton("Want to create a new user?", "New User"))
                {
                    this.nPassword1 = this.nPassword2 = string.Empty;
                    this.nFullName  = this.nUserName = this.nEmail = string.Empty;
                    this.currAction = ASServerAdminWindow.Action.CreateUser;
                }
                GUI.enabled = this.isConnected && this.userSelected && enabled;
                if (this.WordWrappedLabelButton("Need to change user password?", "Set Password"))
                {
                    this.nPassword1 = this.nPassword2 = string.Empty;
                    this.currAction = ASServerAdminWindow.Action.SetPassword;
                }
                if (this.WordWrappedLabelButton("Need to change user information?", "Edit"))
                {
                    this.nFullName  = this.users[this.lv2.row].fullName;
                    this.nEmail     = this.users[this.lv2.row].email;
                    this.currAction = ASServerAdminWindow.Action.ModifyUser;
                }
                GUI.enabled = this.isConnected && this.projectSelected && enabled;
                if (this.WordWrappedLabelButton("Duplicate selected project", "Copy Project"))
                {
                    this.nProjectName         = string.Empty;
                    this.nTemplateProjectName = this.databases[this.lv.row].name;
                    this.currAction           = ASServerAdminWindow.Action.CreateProject;
                }
                if (this.WordWrappedLabelButton("Delete selected project", "Delete Project") && EditorUtility.DisplayDialog("Delete project", "Are you sure you want to delete project " + this.databases[this.lv.row].name + "? This operation cannot be undone!", "Delete", "Cancel") && AssetServer.AdminDeleteDB(this.databases[this.lv.row].name) != 0)
                {
                    this.DoRefreshDatabases();
                    GUIUtility.ExitGUI();
                }
                GUI.enabled = this.isConnected && this.userSelected && enabled;
                if (this.WordWrappedLabelButton("Delete selected user", "Delete User") && EditorUtility.DisplayDialog("Delete user", "Are you sure you want to delete user " + this.users[this.lv2.row].userName + "? This operation cannot be undone!", "Delete", "Cancel") && AssetServer.AdminDeleteUser(this.users[this.lv2.row].userName) != 0)
                {
                    if (this.lv.row > -1)
                    {
                        this.DoGetUsers();
                    }
                    GUIUtility.ExitGUI();
                }
                GUI.enabled = enabled;
                break;

            case ASServerAdminWindow.Action.CreateUser:
                this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                this.nEmail    = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.nUserName = EditorGUILayout.TextField("User Name:", this.nUserName, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.nPassword1 = EditorGUILayout.PasswordField("Password:"******"Repeat Password:"******"Create User", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.SetPassword:
                GUILayout.Label("Setting password for user: "******"Password:"******"Repeat Password:"******"Change Password", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.CreateProject:
                this.nProjectName = EditorGUILayout.TextField("Project Name:", this.nProjectName, new GUILayoutOption[0]);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = this.CanPerformCurrentAction() && enabled;
                if (GUILayout.Button(!(this.nTemplateProjectName == string.Empty) ? "Copy " + this.nTemplateProjectName : "Create Project", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.ModifyUser:
                this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                this.nEmail    = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = this.CanPerformCurrentAction() && enabled;
                if (GUILayout.Button("Change", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;
            }
        }