Get rid of old in_group template tag, it's been superseded by has_role

- Legacy-Id: 6422
This commit is contained in:
Ole Laursen 2013-10-11 13:13:23 +00:00
parent b63c622564
commit b3ed153015
7 changed files with 7 additions and 15 deletions

View file

@ -414,14 +414,6 @@ def equal(x, y):
def startswith(x, y):
return unicode(x).startswith(y)
# based on http://www.djangosnippets.org/snippets/847/ by 'whiteinge'
@register.filter
def in_group(user, groups):
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
return has_role(user, groups.replace("Area_Director", "Area Director"))
return user and user.is_authenticated() and bool(user.groups.filter(name__in=groups.split(',')).values('name'))
@register.filter
def has_role(user, role_names):
from ietf.ietfauth.decorators import has_role

View file

@ -89,7 +89,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<a style="padding: 0;" href="{% url ietf.group.views_stream.streams %}ise/">ISE</a>
</li>
<li><a href="{% url submit_index %}">Submit a draft</a></li>
{% if user|in_group:"WG Chair" %}
{% if user|has_role:"WG Chair" %}
<li><a href="{% url submit_approvals %}">Approve a draft</a></li>
{% endif %}
{% get_user_managed_lists user as community_lists %}
@ -101,7 +101,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% else %}
<li><a href="http://{{ request.get_host }}/accounts/login/?next={{request.get_full_path|urlencode}}" rel="nofollow">Sign in to track drafts</a></li>
{% endif %}
{% if user|in_group:"Area_Director,Secretariat" %}
{% if user|has_role:"Area_Director,Secretariat" %}
<li><a href="{% url rfc_status_changes %}">RFC status changes</a></li>
{% endif %}

View file

@ -26,7 +26,7 @@ form #id_approval_text {
</form>
{% load ietf_filters %}
{% if user|in_group:"Secretariat" %}
{% if user|has_role:"Secretariat" %}
<p>
{% if can_announce %}
<a href="{% url doc_approve_ballot name=doc.name %}">Approve ballot</a>

View file

@ -35,7 +35,7 @@ form #id_last_call_text {
</form>
{% load ietf_filters %}
{% if user|in_group:"Secretariat" %}
{% if user|has_role:"Secretariat" %}
<p>
{% if can_make_last_call %}
<a href="{% url doc_make_last_call name=doc.name %}">Make Last Call</a>

View file

@ -44,7 +44,7 @@ form.edit-info .actions {
{{ form.returning_item }} {{ form.returning_item.label_tag }} {{ form.returning_item.errors }}
{% endifequal %}
{% ifequal field.name "ad" %}
{% if user|in_group:"Area_Director" %}
{% if user|has_role:"Area Director" %}
<label><input type="checkbox" name="ad" value="{{ login.pk }}" /> Assign to me</label>
{% endif %}
{% endifequal %}

View file

@ -33,7 +33,7 @@ form #id_last_call_text {
</form>
{% load ietf_filters %}
{% if user|in_group:"Secretariat" %}
{% if user|has_role:"Secretariat" %}
<p>
<a href="{% url doc_make_last_call name=doc.name %}">Make Last Call</a>
</p>

View file

@ -4,7 +4,7 @@
{% block content %}
<h1>RFC Status Changes</h1>
{% if user|in_group:"Area_Director,Secretariat" %}
{% if user|has_role:"Area Director,Secretariat" %}
<p><a href="{% url start_rfc_status_change name='' %}">Start new RFC status change document</a></p>
{% endif %}
{% regroup docs by get_state as state_groups %}