Commit a2cfbaef authored by Robert Hitt's avatar Robert Hitt

Merge branch 'master' into 'issue#61'

# Conflicts:
#   go/go/templates/link_box.html
parents a1eb1914 ac444542
Pipeline #397 passed with stage
in 3 minutes and 33 seconds
...@@ -25,10 +25,22 @@ This retrieves links to the most up-to-date and secure versions of your packages ...@@ -25,10 +25,22 @@ This retrieves links to the most up-to-date and secure versions of your packages
Next, with: Next, with:
`$ sudo apt-get install python git` `$ sudo apt-get install python python-dev python-pip git`
you install python and git. you install python and git.
**macOS (Formerly OS X)**
This tutorial uses the third party Homebrew package manager for macOS, which allows you to install packages from your terminal just as easily as you could on a Linux based system. You could use another package manager (or not use one at all), but Homebrew is highly reccomended.
To get homebrew, run the following command in a terminal: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)`
**Note**: You do NOT need to use `sudo` when running any Homebrew commands, and it likely won't work if you do.
Next, to make sure Homebrew is up to date, run `brew update`
Finally we can install python and git with `brew install python git`
### Cloning the Go Codebase ### Cloning the Go Codebase
Now, we're going to clone down a copy of the Go codebase from [git.gmu.edu](http://git.gmu.edu/srct/go), the SRCT code respository. Now, we're going to clone down a copy of the Go codebase from [git.gmu.edu](http://git.gmu.edu/srct/go), the SRCT code respository.
...@@ -43,13 +55,28 @@ Now, on your computer, navigate to the directory in which you want to download t ...@@ -43,13 +55,28 @@ Now, on your computer, navigate to the directory in which you want to download t
Finally, install these packages from the standard repositories: Finally, install these packages from the standard repositories:
- VirtualBox - VirtualBox
On Ubuntu:
`$ sudo apt-get install virtualbox` `$ sudo apt-get install virtualbox`
You should be installing the latest VirtualBox version which as of time of writing is `5.0.24_Ubuntur108355`. You can verify the version number by running `vboxmanage --version`.
- Vagrant - Vagrant
`$ sudo apt-get install vagrant` `$ sudo apt-get install vagrant`
You should be installing the latest vagrant version which as of time of writing is `Vagrant 1.8.1`. You can verify the version number by running `vagrant -v`.
- Ansible - Ansible
`$ sudo easy_install pip && sudo pip install ansible` `$ sudo pip install ansible`
You should be installing the latest ansible version which as of time of writing is `ansible 2.1.1.0`. You can verify the version number by running `ansible --version`.
**macOS**
First, get VirtualBox from [VirtualBox.org](https://www.virtualbox.org/wiki/Downloads)
Then install Vagrant and Ansible with Homebrew with `brew install Caskroom/cask/vagrant Ansible`
## Developing with Vagrant ## Developing with Vagrant
<legend></legend> <legend></legend>
...@@ -62,15 +89,15 @@ Navigate to go/ and run: ...@@ -62,15 +89,15 @@ Navigate to go/ and run:
This will setup a vm to run Go on your computer and will setup a database, install packages, etc. The first time you run `vagrant up` it may take a few minutes to setup, specifically when installing Go packages. Don't worry as progressive times it will speed up. This will setup a vm to run Go on your computer and will setup a database, install packages, etc. The first time you run `vagrant up` it may take a few minutes to setup, specifically when installing Go packages. Don't worry as progressive times it will speed up.
And that's it! Navigate to [localhost](http://127.0.0.1:8000) in your web browser to view the website. And that's it! Navigate to [localhost:8000](http://127.0.0.1:8000) in your web browser to view the website.
### Additional Notes ### Additional Notes & Troubleshooting
The authentication service used for Go is CAS. In local development however we utilize a test server. You can log in using your CAS username for both the username and password fields. The authentication service used for Go is CAS. In local development however we utilize a test server. You can log in using your CAS username for both the username and password fields.
The default superuser is _dhaynes3_ though this can be changed in _vagrantfile_ if you wish. You can run `$ vagrant provision` to apply this change. Be sure not to include that change in your commits. The default superuser is _dhaynes3_ though this can be changed in _vagrantfile_ if you wish. You can run `$ vagrant provision` to apply this change. Be sure not to include that change in your commits.
For a currently undetermined reason at some points if you try to navigate to [localhost](http://127.0.0.1:8000) and you see an error like: "Conenction has been reset" then: *Note:* For a currently undetermined reason at some points if you try to navigate to [localhost](http://127.0.0.1:8000) and you see an error like: "Conenction has been reset" then:
1. `vagrant ssh` 1. `vagrant ssh`
2. `sudo /etc/init.d/networking restart` and then `exit` 2. `sudo /etc/init.d/networking restart` and then `exit`
3. `vagrant provision` (may need to do twice) 3. `vagrant provision` (may need to do twice)
...@@ -83,18 +110,6 @@ If you make any changes to _models.py_ you will need to re-provision the vm's da ...@@ -83,18 +110,6 @@ If you make any changes to _models.py_ you will need to re-provision the vm's da
Please note that this will refresh the database (as in delete everything in it). Please note that this will refresh the database (as in delete everything in it).
It is also good practice to shutdown your vm when you are done:
`$ vagrant halt`
and to restart with:
`$ vagrant up`
## On Deployment
<legend></legend>
### Deploying with Vagrant
TODO
### Cron ### Cron
......
...@@ -38,12 +38,22 @@ def pfinfo(uname): ...@@ -38,12 +38,22 @@ def pfinfo(uname):
pfjson = metadata.json() pfjson = metadata.json()
try: try:
if len(pfjson['results']) == 1: if len(pfjson['results']) == 1:
name_str = pfjson['results'][0]['name'] if pfjson['method'] == 'peoplefinder':
name = pfparse(name_str) name_str = pfjson['results'][0]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][0]['givenname'], pfjson['results'][0]['surname']]
else:
name = pfjson['results'][0]['name']
return name return name
else: else:
name_str = pfjson['results'][1]['name'] if pfjson['method'] == 'peoplefinder':
name = pfparse(name_str) name_str = pfjson['results'][1]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][1]['givenname'], pfjson['results'][1]['surname']]
else:
name = pfjson['results'][0]['name']
return name return name
# if the name is not in peoplefinder, return empty first and last name # if the name is not in peoplefinder, return empty first and last name
except IndexError: except IndexError:
......
...@@ -12,8 +12,7 @@ from crispy_forms.helper import FormHelper ...@@ -12,8 +12,7 @@ from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, Submit, HTML, Div, Field from crispy_forms.layout import Layout, Fieldset, Submit, HTML, Div, Field
from crispy_forms.bootstrap import StrictButton, PrependedText, Accordion, AccordionGroup from crispy_forms.bootstrap import StrictButton, PrependedText, Accordion, AccordionGroup
from bootstrap3_datetime.widgets import DateTimePicker from bootstrap3_datetime.widgets import DateTimePicker
import datetime from datetime import date, datetime, timedelta
from datetime import date
class URLForm(forms.ModelForm): class URLForm(forms.ModelForm):
...@@ -89,11 +88,11 @@ class URLForm(forms.ModelForm): ...@@ -89,11 +88,11 @@ class URLForm(forms.ModelForm):
label='Custom Date', label='Custom Date',
input_formats=['%m-%d-%Y'], input_formats=['%m-%d-%Y'],
validators=[valid_date], validators=[valid_date],
initial=lambda: datetime.now() + timedelta(days=1),
widget=DateTimePicker( widget=DateTimePicker(
options={ options={
"format": "MM-DD-YYYY", "format": "MM-DD-YYYY",
"pickTime": False, "pickTime": False,
"defaultDate": (datetime.date.today() + datetime.timedelta(hours=24)).strftime("%m-%d-%Y"),
}, },
icon_attrs={ icon_attrs={
"class": "fa fa-calendar", "class": "fa fa-calendar",
......
...@@ -75,9 +75,9 @@ ...@@ -75,9 +75,9 @@
{% with the_url|add:"?qr" as qr_url %} {% with the_url|add:"?qr" as qr_url %}
<pre><strong>QR Downloads:</strong> <pre><strong>QR Downloads:</strong>
<a href="http://chart.googleapis.com/chart?cht=qr&chs=120x120&chl={{ qr_url }}">Small (120x120)</a> <a href="http://chart.googleapis.com/chart?cht=qr&chs=268x268&chl={{ qr_url }}" target="_blank">Small (268x268)</a>
<a href="http://chart.googleapis.com/chart?cht=qr&chs=230x230&chl={{ qr_url }}">Medium (230x230)</a> <a href="http://chart.googleapis.com/chart?cht=qr&chs=383x383&chl={{ qr_url }}" target="_blank">Medium (383x383)</a>
<a href="http://chart.googleapis.com/chart?cht=qr&chs=350x350&chl={{ qr_url }}">Large (350x350)</a> <a href="http://chart.googleapis.com/chart?cht=qr&chs=547x547&chl={{ qr_url }}" target="_blank">Large (547x547)</a>
</pre> </pre>
{% endwith %} {% endwith %}
...@@ -92,4 +92,4 @@ ...@@ -92,4 +92,4 @@
var option = {'trigger': 'hover'}; var option = {'trigger': 'hover'};
$('[data-toggle="popover"]').popover( option ) $('[data-toggle="popover"]').popover( option )
}) })
</script> </script>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% block title %} {% block title %}
SRCT Go - My Links SRCT Go &bull; My Links
{% endblock %} {% endblock %}
......
...@@ -303,7 +303,7 @@ def useradmin(request): ...@@ -303,7 +303,7 @@ def useradmin(request):
for name in userlist: for name in userlist:
todeny = RegisteredUser.objects.get(user__username__exact=name) todeny = RegisteredUser.objects.get(user__username__exact=name)
if settings.EMAIL_HOST and settings.EMAIL_PORT: if settings.EMAIL_HOST and settings.EMAIL_PORT:
user_mail = todeny.user + settings.EMAIL_DOMAIN user_mail = todeny.user.username + settings.EMAIL_DOMAIN
send_mail( send_mail(
'Your Account has been Denied!', 'Your Account has been Denied!',
###################### ######################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment