diff --git a/doc/LowLevel/UserManagementCreateAccount.svg b/doc/LowLevel/UserManagementCreateAccount.svg new file mode 100644 index 0000000..29aaf69 --- /dev/null +++ b/doc/LowLevel/UserManagementCreateAccount.svg @@ -0,0 +1 @@ +title%20Create%20User%20Record%0Aactor%20User%0Aparticipant%20Controller.cs%20%2390EE90%0Aparticipant%20RDSFactory%20%2326abff%0Aparticipant%20UserAccount%20%23CBC3E3%0Aparticipant%20SystemAccountManager%20%23ffffe0%0Aparticipant%20AccountService%20%23ff8b3d%0Aparticipant%20SqlDAO%20%23D3D3D3%0A%2F%2FSqlDAO%0Adatabase%20SqlServer(MariaDB)%20%2300FFFF%0A%0A%2F%2Factivate%20User%20%0Aactivate%20Controller.cs%20%2390EE90%0AUser-%3EController.cs%3A%20%2B%2BCreate%20new%20User%2B%2B%0A%0A%2F%2FRelatDSFactory%0AController.cs-%3ERDSFactory%3Afactory%20%3D%20new%20RDSFactory()%0Aactivate%20RDSFactory%20%2326abff%0ARDSFactory-%3ERDSFactory%3AConstructor()%0AController.cs%3C--RDSFactory%3Areturn%20RDSFactory%0Adeactivate%20RDSFactory%0AController.cs-%3ESqlDAO%3A%20%2B%2BIDataSource%20factory.GetDataSource(string%20name%2C%20string%20connInfo)%2B%2B%0Aactivate%20SqlDAO%20%23D3D3D3%0ASqlDAO-%3ESqlDAO%3A%2B%2BConstructor(string%20connInfo)%2B%2B%0AController.cs%3C--SqlDAO%3A%20%2B%2Breturn%20SqlDAO%2B%2B%0Adeactivate%20SqlDAO%0A%0A%0A%2F%2F%20Create%20new%20Admin%0AController.cs-%3ESystemAccountManager%3A%2B%2B%20manager%20%3D%20new%20SystemAccountManager(IDataSource%20conn)%2B%2B%0Aactivate%20SystemAccountManager%20%23ffffe0%0ASystemAccountManager-%3ESystemAccountManager%3AConstructor(IDataSource%20conn)%0AController.cs%3C--SystemAccountManager%3A%2B%2B%20New%20SystemAccountManager%2B%2B%0Adeactivate%20SystemAccountManager%0A%0A%2F%2F%0Aactivate%20UserAccount%20%23CBC3E3%0AController.cs-%3EUserAccount%3A%2B%2B%20new%20UserAccount(string%20username%2C%5Cn%20string%20password%2C%5Cn%20string%20email%2C%5Cn%20DateTime%20RegistrationTimeStamp)%2B%2B%0AUserAccount-%3EUserAccount%3A%20%2B%2BConstructor(string%20username%2C%5Cn%20string%20password%2C%5Cn%20string%20email%2C%5Cn%20DateTime%20RegistrationTimeStamp)%2B%2B%0AController.cs%3C--UserAccount%3A%2B%2BNew%20UserAccount%2B%2B%0Adeactivate%20UserAccount%0A%2F%2F%0AController.cs-%3ESystemAccountManager%3A%2B%2Bmanager.CreateUserRecord(user%3AUserAccount)%2B%2B%0A%0A%2F%2Fcheck%20if%20there%20is%20an%20admin%20user%0Aactivate%20SystemAccountManager%20%23ffffe0%0ASystemAccountManager-%3ESqlDAO%3A%2B%2BisAdmin(user%3AUserAccount)%2B%2B%0Aactivate%20SqlDAO%20%23D3D3D3%0ASqlDAO-%3ESqlServer(MariaDB)%3A%2B%2BSqlRead%20confirmAdmin()%2B%2B%0Aactivate%20SqlServer(MariaDB)%2300FFFF%0ASqlServer(MariaDB)-%3ESqlServer(MariaDB)%3A%2B%2BSelect%20*%20from%20Admins%5Cn%20where%20Username%20%3D%20%40UserName%20%5Cnand%20Password%20%3D%20%40Pwd%2B%2B%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2Breturn%20true%2B%2B%0Adeactivate%20SqlServer(MariaDB)%0ASystemAccountManager%3C--SqlDAO%3A%2B%2Breturn%20true%2B%2B%0Adeactivate%20SqlDAO%0A%0A%2F%2FUnauthorized%20role%20section%0Agroup%20%232f2e7b%20Unauthorized%20User%20%23white%0AController.cs%3C--SystemAccountManager%3A%2B%2B%20return%20%22Access%20Denied%3A%20%5CnUnauthorized%22%2B%2B%0Adeactivate%20SystemAccountManager%0AUser%3C--Controller.cs%3A%2B%2Breturn%20%22Access%20Denied%3A%20%5CnUnauthorized%22%2B%2B%0Aend%0A%0A%0A%2F%2FAuthorized%20role%20section%0Agroup%20%23blue%20Authorized%20User%20%23white%0Aactivate%20SystemAccountManager%20%23ffffe0%0ASystemAccountManager-%3ESystemAccountManager%3A%2B%2BValidCredentials(user%3A%20UserAccount)%2B%2B%0Agroup%20%23red%20Invalid%20Information%20%23white%0AController.cs%3C--SystemAccountManager%3A%2B%2Breturn%20%22Invalid%20input%22%2B%2B%0AUser%3C--Controller.cs%3A%2B%2B%20return%20%22Invalid%20input%22%2B%2B%0Adeactivate%20SystemAccountManager%0Aend%0Agroup%20%23green%20Valid%20Information%20%23white%0Aactivate%20SystemAccountManager%20%23ffffe0%0ASystemAccountManager-%3EAccountService%3A%2B%2BAccountService.CreateUserRecord(user%3AUserAccount)%2B%2B%0Aactivate%20AccountService%20%09%23ff8b3d%0AAccountService-%3ESqlDAO%3A%2B%2BSqlDAO%5Cn.CreateUserRecord(user%3AUserAccount)%2B%2B%0Aactivate%20SqlDAO%20%23D3D3D3%0ASqlDAO-%3ESqlServer(MariaDB)%3A%2B%2BisUser(user%3AUserAccount)%2B%2B%0Aactivate%20SqlServer(MariaDB)%20%2300FFFF%0ASqlServer(MariaDB)-%3ESqlServer(MariaDB)%3A%2B%2B%20Select%20*%5CnFrom%20Users%5Cnwhere%20Username%5Cn%3D%20%40UserName%20OR%5Cnemail%20%3D%20%40Email%2B%2B%0Agroup%20%23red%20data%20store%20timed%20out%20%23white%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2BSqlException%2B%2B%0Adeactivate%20SqlServer(MariaDB)%0ASqlDAO-%3ESqlDAO%3A%20%20%20%20%20%20%2B%2BCatch%5CnSqlException%2B%2B%0AAccountService%3C--SqlDAO%3A%2B%2Breturn%20%22Database%20timed%20out%22%2B%2B%0A%0ASystemAccountManager%3C--AccountService%3A%2B%2B%20return%20%22Database%20timed%20out%22%2B%2B%0AController.cs%3C--SystemAccountManager%3A%2B%2B%20return%20%22Database%20timed%20out%22%2B%2B%0AUser%3C--Controller.cs%3A%2B%2B%20return%20%22Database%20timed%20out%22%2B%2B%0Aend%0Agroup%20%23blue%20data%20store%20is%20online%20%23white%0A%2F%2F%20User%20exists%0Agroup%20%23green%20User%20does%20exist%20%23white%0Aactivate%20SqlServer(MariaDB)%20%2300FFFF%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2B%20return%20True%2B%2B%0AAccountService%3C--SqlDAO%3A%2B%2Breturn%20%22User%20is%20already%20registered%22%2B%2B%0ASystemAccountManager%3C--AccountService%3A%2B%2Breturn%20%22User%20is%20already%20registered%22%2B%2B%0AController.cs%3C--SystemAccountManager%3A%2B%2Breturn%20%22User%20is%20already%20registered%22%2B%2B%0AUser%3C--Controller.cs%3A%2B%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20%5Cn%22User%20is%20already%20registered%22%2B%2B%0Adeactivate%20SqlServer(MariaDB)%0Aend%20%0A%2F%2F%20User%20doesn't%20exist%0Agroup%20%23green%20User%20does%20not%20exist%20%23white%0Aactivate%20SqlServer(MariaDB)%20%2300FFFF%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2B%20return%20False%2B%2B%0ASqlDAO-%3ESqlServer(MariaDB)%3A%2B%2B%20SQL%20insert%5Cnuser%20credentials%2B%2B%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2B%20return%201%2B%2B%0AAccountService%3C--SqlDAO%3A%2B%2Breturn%20%22User%20is%20now%20registered%22%2B%2B%0ASystemAccountManager%3C--AccountService%3A%2B%2Breturn%20%22User%20is%20now%20registered%22%2B%2B%0AController.cs%3C--SystemAccountManager%3A%2B%2Breturn%20%22User%20is%20now%20registered%22%2B%2B%0AUser%3C--Controller.cs%3A%2B%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20%5Cn%22User%20is%20now%20registered%22%2B%2B%0Adeactivate%20AccountService%0Adeactivate%20SqlDAO%0Adeactivate%20SqlServer(MariaDB)%0Adeactivate%20SystemAccountManager%0Adeactivate%20Controller.cs%0Aend%0A%2F%2Fdeactivate%20User%0Aend%0Aend%0AendCreate User RecordUserController.csRDSFactoryUserAccountSystemAccountManagerAccountServiceSqlDAOSqlServer(MariaDB)Create new Userfactory = new RDSFactory()Constructor()return RDSFactoryIDataSource factory.GetDataSource(string name, string connInfo)Constructor(string connInfo)return SqlDAO manager = new SystemAccountManager(IDataSource conn)Constructor(IDataSource conn) New SystemAccountManager new UserAccount(string username, string password, string email, DateTime RegistrationTimeStamp)Constructor(string username, string password, string email, DateTime RegistrationTimeStamp)New UserAccountmanager.CreateUserRecord(user:UserAccount)isAdmin(user:UserAccount)SqlRead confirmAdmin()Select * from Admins where Username = @UserName and Password = @Pwdreturn truereturn true return "Access Denied: Unauthorized"return "Access Denied: Unauthorized"ValidCredentials(user: UserAccount)return "Invalid input" return "Invalid input"AccountService.CreateUserRecord(user:UserAccount)SqlDAO.CreateUserRecord(user:UserAccount)isUser(user:UserAccount) Select *From Userswhere Username= @UserName ORemail = @EmailSqlException     CatchSqlExceptionreturn "Database timed out" return "Database timed out" return "Database timed out" return "Database timed out" return Truereturn "User is already registered"return "User is already registered"return "User is already registered"               return "User is already registered" return False SQL insertuser credentials return 1return "User is now registered"return "User is now registered"return "User is now registered"               return "User is now registered"Unauthorized UserAuthorized UserInvalid InformationValid Informationdata store timed outdata store is onlineUser does existUser does not exist \ No newline at end of file