5.9. Server (server.rsl)
object Server is users:Users and udb:UserDatabase
description: (*
A server has a list of authentic users and a database.
Note that we are abstracting out server access because it is
beyond the scope of this course.
*);
end Server;
object Users is UserRecord*;
object UserRecord is uid:UserID and pw:Password;
object UserID is string;
object Password is string;
object UserDatabase is string;
operation Login
inputs: s:Server, uid:UserID, pw:Password;
outputs: udb:UserDatabase;
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.
*);
precondition:
(*
* User name and password combo must exist on server.
*)
exists (u in s.users) (u.uid = uid) and (u.pw = pw);
postcondition:
(*
* If UserID and Password are valid, return database.
*)
udb = s.udb;
end Login;
Prev: grading.rsl
| Next: [none]
| Up: formal specification
| Top: index