(**** * * Module Login defines the objects and operations related to the Login Process * in the Schedule system. * *) module ServerAdmin; from ScheduleDB import PermanentDatabase; operation Login inputs: s:Server and uid:UserID and passwd:Password; outputs: db:Database; precondition: exists (u in s.users) (u.uid = uid) and (u.passwd = passwd) and (u.type = true); postcondition: db = s.db; description: (* Login to the given server to access its database. If the user name and password exist on the server's user list, then return the database, otherwise nil. *); end; object Server = users:Userslist and db:Database description: (* A server has a list of authentic users and a database. Note that we are abstracting out server access via some form of network address. Think about how this would be modeled. *); end; operation ChangetoAdmin inputs: s:Server and uid:UserID and passwd:Password and type:Admin and uidtoChange:UserID; outputs: ur:UserRecord; precondition: exists (u in s.users) (u.uid = uid) and (u.passwd = passwd) and (u.type = true) and exists (su in s.users) (su.uid = uidtoChange) and (su.type = false); postcondition: exists (u in s.users) (u.uid = uidtoChange) and (u.type = true); description: (* This operation will change the uidtoChange that is passed in to a Admin so that they may edit the schedule. This is used if the scheduler is changed to another instructor or if the instructor is gone for some reason another teacher can edit the schedule. *); end; object Userslist = UserRecord*; object UserRecord = uid:UserID and passwd:Password and type:Admin; object Admin = boolean; object UserID = string; object Password = string; object Database = PermanentDatabase; end ServerAdmin;