summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2008-07-21 22:51:36 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2008-07-21 22:51:36 (GMT)
commit44a665a09983d74084d0cf2679ef360e59d0542e (patch)
tree93f1b39e1c02195937bcc30f54888fcb6962f01d
parent99635d0efea78a197cf667087d43f380a7da4e03 (diff)
downloadfas-44a665a09983d74084d0cf2679ef360e59d0542e.zip
fas-44a665a09983d74084d0cf2679ef360e59d0542e.tar.gz
fas-44a665a09983d74084d0cf2679ef360e59d0542e.tar.xz
Replaces Location and Country code privacy with some basic catch all privacy.
-rw-r--r--fas/model/fasmodel.py8
-rw-r--r--fas/templates/user/edit.html14
-rw-r--r--fas/templates/user/view.html1
-rw-r--r--fas/user.py8
4 files changed, 21 insertions, 10 deletions
diff --git a/fas/model/fasmodel.py b/fas/model/fasmodel.py
index 8de96ea..d90380b 100644
--- a/fas/model/fasmodel.py
+++ b/fas/model/fasmodel.py
@@ -356,7 +356,7 @@ class People(SABase):
return self
# The user themselves gets everything except internal_comments
- if identity.current.user_name != self.username:
+ if identity.current.user_name == self.username:
return PeopleSelf.by_username(self.username)
# Anonymous users get very little
@@ -550,12 +550,12 @@ mapper(People, PeopleTable, properties = {
'approved_roles': relation(ApprovedRoles, backref='member',
primaryjoin = PeopleTable.c.id==ApprovedRoles.c.person_id),
'unapproved_roles': relation(UnApprovedRoles, backref='member',
- primaryjoin = PeopleTable.c.id==UnApprovedRoles.c.person_id)
+ primaryjoin = PeopleTable.c.id==UnApprovedRoles.c.person_id),
+ 'roles': relation(PersonRoles, backref='member',
+ primaryjoin = PersonRolesTable.c.person_id==PeopleTable.c.id)
})
mapper(PersonRoles, PersonRolesTable, properties = {
- 'member': relation(People, backref = 'roles', lazy = False,
- primaryjoin=PersonRolesTable.c.person_id==PeopleTable.c.id),
'group': relation(Groups, backref='roles', lazy = False,
primaryjoin=PersonRolesTable.c.group_id==GroupsTable.c.id),
'sponsor': relation(People, uselist=False,
diff --git a/fas/templates/user/edit.html b/fas/templates/user/edit.html
index 5fc512a..36514b9 100644
--- a/fas/templates/user/edit.html
+++ b/fas/templates/user/edit.html
@@ -54,13 +54,14 @@
</select>
<script type="text/javascript">var hb6 = new HelpBalloon({dataURL: '${tg.url('/help/get_help/user_country_code')}'});</script>
</div>
- <div class="field">
+<!-- <div class="field">
<label for="share_country_code">${_('Share Country Code')}:</label>
<input type="checkbox" id="share_country_code" name="share_country_code"
py:attrs="dict(checked=(target.get_share_cc() and True or None))" />
- <!-- Unfortunately, checked can't be used as a boolean, only as a flag. Silly HTML4 standard -->
+Unfortunately, checked can't be used as a boolean, only as a flag. Silly HTML4 standard
<script type="text/javascript">var hb_share_cc = new HelpBalloon({dataURL: '${tg.url('/help/get_help/share_country_code')}'});</script>
</div>
+-->
<div class="field">
<label for="latitude">${_('Latitude')}:</label>
<input type="text" id="latitude" name="latitude" value="${target.latitude}" />
@@ -71,12 +72,14 @@
<input type="text" id="longitude" name="longitude" value="${target.longitude}" />
<script type="text/javascript">var hb_longitude = new HelpBalloon({dataURL: '${tg.url('/help/get_help/latitude_and_longitude')}'});</script>
</div>
+<!--
<div class="field">
<label for="share_location">${_('Share Location')}:</label>
<input type="checkbox" id="share_location" name="share_location"
py:attrs="dict(checked=(target.get_share_loc() and True or None))" />
<script type="text/javascript">var hb_share_loc = new HelpBalloon({dataURL: '${tg.url('/help/get_help/share_location')}'});</script>
</div>
+ -->
<div class="field">
<label for="ircnick">${_('IRC Nick')}:</label>
<input type="text" id="ircnick" name="ircnick" value="${target.ircnick}" />
@@ -123,6 +126,13 @@
<textarea id="comments" name="comments">${target.comments}</textarea>
<script type="text/javascript">var hb8 = new HelpBalloon({dataURL: '${tg.url('/help/get_help/user_comments')}'});</script>
</div>
+ <br />
+ <div class="field">
+ <label for="privacy ">${_('Privacy')}:</label>
+ <inpu py:attrs="dict(checked=(target.privacy and True or None))"
+ type="checkbox" id="privacy" name="privacy">${target.privacy}</input>
+ <script type="text/javascript">var hb_privacy = new HelpBalloon({dataURL: '${tg.url("/help/get_help/privacy")}'});</script>
+ </div>
<div class="field">
<input type="submit" value="${_('Save!')}" />
<a href="${tg.url('/user/view/%s' % target.username)}">${_('Cancel')}</a>
diff --git a/fas/templates/user/view.html b/fas/templates/user/view.html
index 04d7231..6867af6 100644
--- a/fas/templates/user/view.html
+++ b/fas/templates/user/view.html
@@ -11,6 +11,7 @@
from fas import auth
from fas.model import People
viewer = People.by_username(tg.identity.user.username)
+ person = person.filter_private()
?>
<h2 class="account" py:if="personal">${_('Your Fedora Account')}</h2>
<h2 class="account" py:if="not personal">${_('%s\'s Fedora Account') % person.human_name}</h2>
diff --git a/fas/user.py b/fas/user.py
index 2425ca0..2fa7731 100644
--- a/fas/user.py
+++ b/fas/user.py
@@ -244,8 +244,7 @@ class User(controllers.Controller):
def save(self, targetname, human_name, telephone, postal_address,
email, status, ssh_key=None, ircnick=None, gpg_keyid=None,
comments='', locale='en', timezone='UTC', country_code='',
- latitude=None, longitude=None, share_location=False,
- share_country_code=True):
+ latitude=None, longitude=None, privacy=False):
languages = available_languages()
username = identity.current.user_name
@@ -308,8 +307,9 @@ https://admin.fedoraproject.org/accounts/user/verifyemail/%s
target.country_code = country_code
target.latitude = latitude and float(latitude) or None
target.longitude = longitude and float(longitude) or None
- target.set_share_cc(share_country_code)
- target.set_share_loc(share_location)
+ target.privacy = privacy
+# target.set_share_cc(share_country_code)
+# target.set_share_loc(share_location)
except TypeError, e:
turbogears.flash(_('Your account details could not be saved: %s') % e)
turbogears.redirect("/user/edit/%s" % target.username)