Fixed ballot icon/etc. to work with the new auth/authz system

- Legacy-Id: 1878
This commit is contained in:
Pasi Eronen 2009-11-27 18:39:24 +00:00
parent 11887ca938
commit 54589f8c16
3 changed files with 13 additions and 23 deletions

View file

@ -37,26 +37,16 @@ from ietf.idtracker.templatetags.ietf_filters import in_group, timesince_days
register = template.Library()
def get_user_adid(context):
if 'user' in context and in_group(context['user'], "iesg"):
try:
usermap = context['user'].usermap_set.all()[0]
person = usermap.person
iesglogin = person.iesglogin_set.all()[0]
adId = iesglogin.id
return adId
except:
pass
return None
if 'user' in context and in_group(context['user'], "Area_Director"):
return context['user'].get_profile().iesg_login_id()
else:
return None
def get_user_name(context):
if 'user' in context and context['user'].is_authenticated():
try:
usermap = context['user'].usermap_set.all()[0]
person = usermap.person
if person:
return str(person)
except:
pass
person = context['user'].get_profile().person()
if person:
return str(person)
return None
def render_ballot_icon(context, doc):
@ -140,7 +130,7 @@ def my_position(doc, user):
user_name = get_user_name({'user':user})
if not user_name:
return None
if not in_group(user, "iesg"):
if not in_group(user, "Area_Director"):
return None
if not doc.in_ietf_process():
return None

View file

@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% load ballot_icon %}
{% load ietf_filters %}
<tr
{% if user|in_group:"IESG" %}
{% if user|in_group:"Area_Director" %}
{% if doc|my_position:user|equal:"Discuss" %}style="background:#ffa0a0;"{% endif %}
{% if doc|my_position:user|equal:"Yes" or doc|my_position:user|slugify|equal:"no-objection" %}style="background:#a0ffa0;"{% endif %}
{% if doc|my_position:user|equal:"Abstain" or doc|my_position:user|equal:"Recuse" %}style="background:#c0c0c0;"{% endif %}
@ -63,4 +63,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<td class="ballot">{% ballot_icon doc %}</td>
<td class="ad">{% if doc.ad_name %}{{ doc.ad_name|escape }}{% else %}&nbsp;{% endif %}</td>
</tr>
</tr>

View file

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<h1 style="margin-top:0;">IESG Discuss Positions</h1>
{% if user|in_group:"IESG" %}
{% if user|in_group:"Area_Director" %}
<div id="discuss_show1" style="display:block;">
<a href="javascript:show_only_mine()">Show only my discusses</a>
</div>
@ -61,7 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<table id="discuss_table">
<tr><th class="doc">Document</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th><th>Discusses</th></tr>
{% for doc in docs %}
<tr {% if user|in_group:"IESG" %}{% if doc|my_position:user|equal:"Discuss" %}
<tr {% if user|in_group:"Area_Director" %}{% if doc|my_position:user|equal:"Discuss" %}
class="discuss_my" {% else %} class="discuss_not_my" {% endif %}{% endif %}>
<td class="doc">
{% if doc.is_rfc_wrapper %}
@ -109,4 +109,4 @@ for (i =0; i < els.length; i++) {
}
//]]>
</script>
{% endblock %}
{% endblock %}