diff --git a/doc/LowLevel/UserManagement/User Management_ Create Account - SequenceDiagram.org.pdf b/doc/LowLevel/UserManagement/User Management_ Create Account - SequenceDiagram.org.pdf new file mode 100644 index 0000000..154cc19 Binary files /dev/null and b/doc/LowLevel/UserManagement/User Management_ Create Account - SequenceDiagram.org.pdf differ diff --git a/doc/LowLevel/UserManagement/User Management_ Create Account.png b/doc/LowLevel/UserManagement/User Management_ Create Account.png new file mode 100644 index 0000000..61e4c74 Binary files /dev/null and b/doc/LowLevel/UserManagement/User Management_ Create Account.png differ diff --git a/doc/LowLevel/UserManagement/User Management_ Create Account.svg b/doc/LowLevel/UserManagement/User Management_ Create Account.svg index 29aaf69..de6f5da 100644 --- a/doc/LowLevel/UserManagement/User Management_ Create Account.svg +++ b/doc/LowLevel/UserManagement/User Management_ Create Account.svg @@ -1 +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 +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%3A%2B%2Bfactory%20%3D%20new%20RDSFactory()%2B%2B%0Aactivate%20RDSFactory%20%2326abff%0ARDSFactory-%3ERDSFactory%3A%2B%2BConstructor()%2B%2B%0AController.cs%3C--RDSFactory%3A%2B%2Breturn%20RDSFactory%2B%2B%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%0Agroup%20%23red%20Data%20Store%20Timed%20Out%20%23white%0ASqlDAO-%3ESqlDAO%3A%20%2B%2BCatch%20SqlException%2B%2B%0AController.cs%3C--SqlDAO%3A%2B%2Breturn%20%22Data%20Source%20Timed%20Out%22%2B%2B%0Aend%0Agroup%20%23blue%20Data%20Store%20Online%20%23white%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%3A%2B%2BConstructor(IDataSource%20conn)%2B%2B%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%2Bbool%20isAdmin(user%3AUserAccount)%2B%2B%0Aactivate%20SqlDAO%20%23D3D3D3%0ASqlDAO-%3ESqlServer(MariaDB)%3A%2B%2BSqlRead%20confirmAdmin()%2B%2B%0Aactivate%20SqlServer(MariaDB)%2300FFFF%0A%2F%2Fauthorized%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%0A%2F%2FUnauthorized%20role%20section%0Agroup%20%23red%20Unauthorized%20User%20%23white%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2BSqlException%2B%2B%0ASqlDAO-%3ESqlDAO%3A%20%20%20%20%20%20%2B%2BCatch%5CnSqlException%2B%2B%0ASystemAccountManager%3C--SqlDAO%3A%2B%2Breturn%20false%2B%2B%0AController.cs%3C--SystemAccountManager%3A%2B%2B%20return%20%22Access%20Denied%3A%20%5CnUnauthorized%22%2B%2B%0AUser%3C--Controller.cs%3A%2B%2Breturn%20%22Access%20Denied%3A%20%5CnUnauthorized%22%2B%2B%0Aend%0A%2F%2FUnauthorized%20role%20section%0Agroup%20%23red%20Unauthorized%20User%20%23white%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2Breturn%20false%2B%2B%0ASystemAccountManager%3C--SqlDAO%3A%2B%2Breturn%20false%2B%2B%0AController.cs%3C--SystemAccountManager%3A%2B%2B%20return%20%22Access%20Denied%3A%20%5CnUnauthorized%22%2B%2B%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%0ASqlDAO%3C--SqlServer(MariaDB)%3A%2B%2Breturn%20true%2B%2B%0Adeactivate%20SqlServer(MariaDB)%0ASystemAccountManager%3C--SqlDAO%3A%2B%2Breturn%20true%2B%2B%0Adeactivate%20SqlDAO%0Adeactivate%20SystemAccountManager%0Aactivate%20SystemAccountManager%20%23ffffe0%0ASystemAccountManager-%3ESystemAccountManager%3A%2B%2BisInputValid(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%2BSqlRead%20%5CnisUser(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%0Aend%0Aend%0AendCreate User RecordUserController.csRDSFactoryUserAccountSystemAccountManagerAccountServiceSqlDAOSqlServer(MariaDB)Create new Userfactory = new RDSFactory()Constructor()return RDSFactoryIDataSource factory.GetDataSource(string name, string connInfo)Constructor(string connInfo)Catch SqlExceptionreturn "Data Source Timed Out"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)bool isAdmin(user:UserAccount)SqlRead confirmAdmin()Select * from Admins where Username = @UserName and Password = @PwdSqlException     CatchSqlExceptionreturn false return "Access Denied: Unauthorized"return "Access Denied: Unauthorized"return falsereturn false return "Access Denied: Unauthorized"return "Access Denied: Unauthorized"return truereturn trueisInputValid(user: UserAccount)return "Invalid input" return "Invalid input"AccountService.CreateUserRecord(user:UserAccount)SqlDAO.CreateUserRecord(user:UserAccount)SqlRead 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"Data Store Timed OutData Store OnlineUnauthorized UserUnauthorized UserAuthorized UserInvalid InformationValid Informationdata store timed outdata store is onlineUser does existUser does not exist \ No newline at end of file diff --git a/doc/LowLevel/UserManagement/User Management_ Create Account.txt b/doc/LowLevel/UserManagement/User Management_ Create Account.txt new file mode 100644 index 0000000..ba4e2df --- /dev/null +++ b/doc/LowLevel/UserManagement/User Management_ Create Account.txt @@ -0,0 +1,140 @@ +title Create User Record +actor User +participant Controller.cs #90EE90 +participant RDSFactory #26abff +participant UserAccount #CBC3E3 +participant SystemAccountManager #ffffe0 +participant AccountService #ff8b3d +participant SqlDAO #D3D3D3 +//SqlDAO +database SqlServer(MariaDB) #00FFFF + +//activate User +activate Controller.cs #90EE90 +User->Controller.cs: ++Create new User++ + +//RelatDSFactory +Controller.cs->RDSFactory:++factory = new RDSFactory()++ +activate RDSFactory #26abff +RDSFactory->RDSFactory:++Constructor()++ +Controller.cs<--RDSFactory:++return RDSFactory++ +deactivate RDSFactory +Controller.cs->SqlDAO: ++IDataSource factory.GetDataSource(string name, string connInfo)++ +activate SqlDAO #D3D3D3 +SqlDAO->SqlDAO:++Constructor(string connInfo)++ +group #red Data Store Timed Out #white +SqlDAO->SqlDAO: ++Catch SqlException++ +Controller.cs<--SqlDAO:++return "Data Source Timed Out"++ +end +group #blue Data Store Online #white +Controller.cs<--SqlDAO: ++return SqlDAO++ +deactivate SqlDAO + + +// Create new Admin +Controller.cs->SystemAccountManager:++ manager = new SystemAccountManager(IDataSource conn)++ +activate SystemAccountManager #ffffe0 +SystemAccountManager->SystemAccountManager:++Constructor(IDataSource conn)++ +Controller.cs<--SystemAccountManager:++ New SystemAccountManager++ +deactivate SystemAccountManager + +// +activate UserAccount #CBC3E3 +Controller.cs->UserAccount:++ new UserAccount(string username,\n string password,\n string email,\n DateTime RegistrationTimeStamp)++ +UserAccount->UserAccount: ++Constructor(string username,\n string password,\n string email,\n DateTime RegistrationTimeStamp)++ +Controller.cs<--UserAccount:++New UserAccount++ +deactivate UserAccount +// +Controller.cs->SystemAccountManager:++manager.CreateUserRecord(user:UserAccount)++ + +//check if there is an admin user +activate SystemAccountManager #ffffe0 +SystemAccountManager->SqlDAO:++bool isAdmin(user:UserAccount)++ +activate SqlDAO #D3D3D3 +SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++ +activate SqlServer(MariaDB)#00FFFF +//authorized +SqlServer(MariaDB)->SqlServer(MariaDB):++Select * from Admins\n where Username = @UserName \nand Password = @Pwd++ +//Unauthorized role section +group #red Unauthorized User #white +SqlDAO<--SqlServer(MariaDB):++SqlException++ +SqlDAO->SqlDAO: ++Catch\nSqlException++ +SystemAccountManager<--SqlDAO:++return false++ +Controller.cs<--SystemAccountManager:++ return "Access Denied: \nUnauthorized"++ +User<--Controller.cs:++return "Access Denied: \nUnauthorized"++ +end +//Unauthorized role section +group #red Unauthorized User #white +SqlDAO<--SqlServer(MariaDB):++return false++ +SystemAccountManager<--SqlDAO:++return false++ +Controller.cs<--SystemAccountManager:++ return "Access Denied: \nUnauthorized"++ +User<--Controller.cs:++return "Access Denied: \nUnauthorized"++ +end + + +//Authorized role section +group #blue Authorized User #white +SqlDAO<--SqlServer(MariaDB):++return true++ +deactivate SqlServer(MariaDB) +SystemAccountManager<--SqlDAO:++return true++ +deactivate SqlDAO +deactivate SystemAccountManager +activate SystemAccountManager #ffffe0 +SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++ +group #red Invalid Information #white +Controller.cs<--SystemAccountManager:++return "Invalid input"++ +User<--Controller.cs:++ return "Invalid input"++ +deactivate SystemAccountManager +end +group #green Valid Information #white +activate SystemAccountManager #ffffe0 +SystemAccountManager->AccountService:++AccountService.CreateUserRecord(user:UserAccount)++ +activate AccountService #ff8b3d +AccountService->SqlDAO:++SqlDAO\n.CreateUserRecord(user:UserAccount)++ +activate SqlDAO #D3D3D3 +SqlDAO->SqlServer(MariaDB):++SqlRead \nisUser(user:UserAccount)++ +activate SqlServer(MariaDB) #00FFFF +SqlServer(MariaDB)->SqlServer(MariaDB):++ Select *\nFrom Users\nwhere Username\n= @UserName OR\nemail = @Email++ +group #red data store timed out #white +SqlDAO<--SqlServer(MariaDB):++SqlException++ +deactivate SqlServer(MariaDB) +SqlDAO->SqlDAO: ++Catch\nSqlException++ +AccountService<--SqlDAO:++return "Database timed out"++ + +SystemAccountManager<--AccountService:++ return "Database timed out"++ +Controller.cs<--SystemAccountManager:++ return "Database timed out"++ +User<--Controller.cs:++ return "Database timed out"++ +end +group #blue data store is online #white +// User exists +group #green User does exist #white +activate SqlServer(MariaDB) #00FFFF +SqlDAO<--SqlServer(MariaDB):++ return True++ +AccountService<--SqlDAO:++return "User is already registered"++ +SystemAccountManager<--AccountService:++return "User is already registered"++ +Controller.cs<--SystemAccountManager:++return "User is already registered"++ +User<--Controller.cs:++ return \n"User is already registered"++ +deactivate SqlServer(MariaDB) +end +// User doesn't exist +group #green User does not exist #white +activate SqlServer(MariaDB) #00FFFF +SqlDAO<--SqlServer(MariaDB):++ return False++ +SqlDAO->SqlServer(MariaDB):++ SQL insert\nuser credentials++ +SqlDAO<--SqlServer(MariaDB):++ return 1++ +AccountService<--SqlDAO:++return "User is now registered"++ +SystemAccountManager<--AccountService:++return "User is now registered"++ +Controller.cs<--SystemAccountManager:++return "User is now registered"++ +User<--Controller.cs:++ return \n"User is now registered"++ +deactivate AccountService +deactivate SqlDAO +deactivate SqlServer(MariaDB) +deactivate SystemAccountManager +deactivate Controller.cs +end +//deactivate User +end +end +end +end +end \ No newline at end of file