Fixed Role not exist warning in user create (#1737)

This commit is contained in:
Ahmad Farhat 2020-06-03 14:44:45 -04:00 committed by GitHub
parent a61b96289e
commit 33ca929630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -23,6 +23,12 @@ namespace :user do
puts "Missing Arguments"
exit
end
unless Role.exists?(name: u[:role], provider: u[:provider])
puts "Invalid Role - Role does not exist"
exit
end
u[:email].prepend "superadmin-" if args[:role] == "super_admin"
# Create account if it doesn't exist
@ -36,11 +42,6 @@ namespace :user do
exit
end
unless Role.exists?(name: u[:role], provider: u[:provider])
puts "Invalid Role - Role does not exist"
exit
end
user.set_role(u[:role])
puts "Account succesfully created."