From da6b946ac51426e861c5469baecb2fefd8a25f7e Mon Sep 17 00:00:00 2001 From: Sarika Dani Date: Sun, 6 Mar 2016 12:22:57 -0500 Subject: [PATCH] And another one --- admin.rb | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/admin.rb b/admin.rb index 06551b9..d2292b6 100644 --- a/admin.rb +++ b/admin.rb @@ -1,7 +1,7 @@ require 'pry' -#you run a site that offers a matching service between vendors selling laptops and customers -#..looking to purchase; you charge a fee to be listed as a vendor +#you run a site that offers a matching service between vendors selling laptops and customers +#..looking to purchase; you charge a fee to be listed as a vendor #your site's users must sign in and if they are an admin they are able to make changes to the site ####################################################### @@ -12,20 +12,36 @@ #if the user is signed in but they are not an admin, show "you can see all the pages!" #if the user is not signed in, show "you can't see any of the pages, please sign in!" -#ask the user if they pay their bills (yes/no) +def user_permission(signed_in, admin, paid, cancelled) + if paid.include?("no") or cancelled.include?("yes") + puts "go away!" + elsif signed_in.include?("yes") and admin.include?("yes") + puts "you can see and change all the pages!" + elsif signed_in.include?("yes") and admin.include?("no") + puts "you can see all the pages!" + else + puts "you can't see any of the pages, please sign in!" + end +end -#store their answer in a variable -#ask the user if they have cancelled a deal (yes/no) +#ask the user if they pay their bills (yes/no) +puts "Have you paid your bills? (Answer yes/ no)" #store their answer in a variable - +billpayer = gets.strip +#ask the user if they have cancelled a deal (yes/no) +puts "Have you cancelled a deal? (Answer yes/no)" +#store their answer in a variable +dealcanceller = gets.strip #ask the user if they are an admin (yes/no) - +puts "Are you an admin? (Answer yes/no)" #store their answer in a variable - +adminanswer = gets.strip #ask the user if they are signed in (yes/no) - +puts "Are you signed in? (Answer yes/no)" #store their answer in a variable +signedinanswer = gets.strip +#call the function -#call the function +user_permission(signedinanswer, adminanswer, billpayer, dealcanceller)