Merge pull request #701 from dod-ccpo/portfolio-perms

Portfolio perms
This commit is contained in:
dandds
2019-03-18 08:40:35 -04:00
committed by GitHub
60 changed files with 940 additions and 738 deletions

View File

@@ -3,7 +3,7 @@
{% extends "portfolios/base.html" %}
{% set can_create_applications = user_can(permissions.ADD_APPLICATION_IN_PORTFOLIO) %}
{% set can_create_applications = user_can(permissions.CREATE_APPLICATION) %}
{% block portfolio_content %}
@@ -41,13 +41,13 @@
<h3 class='icon-link accordian__title' v-on:click="props.toggle">{{ application.name }}</h3>
<span class='accordian__description'>{{ application.description }}</span>
<div class='accordian__actions'>
{% if user_can(permissions.RENAME_APPLICATION_IN_PORTFOLIO) %}
{% if user_can(permissions.EDIT_APPLICATION) %}
<a class='icon-link' href='{{ url_for("portfolios.edit_application", portfolio_id=portfolio.id, application_id=application.id) }}'>
<span>{{ "portfolios.applications.app_settings_text" | translate }}</span>
</a>
<div class='separator'></div>
{% endif %}
{% if user_can(permissions.VIEW_PORTFOLIO_MEMBERS) %}
{% if user_can(permissions.VIEW_PORTFOLIO_USERS) %}
<a class='icon-link' href='{{ url_for("portfolios.application_members", portfolio_id=portfolio.id, application_id=application.id) }}'>
<span>{{ "portfolios.applications.team_text" | translate }}</span>
<span class='counter'>{{ application.num_users }}</span>

View File

@@ -11,7 +11,7 @@
{% if not portfolio.members %}
{% set user_can_invite = user_can(permissions.ASSIGN_AND_UNASSIGN_ATAT_ROLE) %}
{% set user_can_invite = user_can(permissions.CREATE_PORTFOLIO_USERS) %}
{{ EmptyState(
'There are currently no members in this Portfolio.',

View File

@@ -56,7 +56,7 @@
</div>
</div>
<div class='row links'>
{% if user_can(permissions.VIEW_USAGE_DOLLARS) %}
{% if user_can(permissions.VIEW_PORTFOLIO_REPORTS) %}
{{ Link(
icon='chart-pie',
text='navigation.portfolio_navigation.breadcrumbs.reports' | translate,
@@ -70,7 +70,7 @@
url=url_for("portfolios.portfolio_funding", portfolio_id=portfolio.id),
active=request.url_rule.endpoint == "portfolios.portfolio_funding",
) }}
{% if user_can(permissions.EDIT_PORTFOLIO_INFORMATION) %}
{% if user_can(permissions.EDIT_PORTFOLIO_NAME) %}
{{ Link(
icon='cog',
text='navigation.portfolio_navigation.breadcrumbs.admin' | translate,

View File

@@ -21,7 +21,30 @@
<h1 class='member-card__heading'>{{ member.user.full_name }}</h1>
<div class="usa-input member-card__input">
{{ Selector(form.portfolio_role) }}
<table>
<thead>
<tr>
<th>{{ "portfolios.members.permissions.app_mgmt" | translate }}</th>
<th>{{ "portfolios.members.permissions.funding" | translate }}</th>
<th>{{ "portfolios.members.permissions.reporting" | translate }}</th>
<th>{{ "portfolios.members.permissions.portfolio_mgmt" | translate }}</th>
</tr>
</thead>
<tbody>
<td>
{{ form.perms_app_mgmt() }}
</td>
<td>
{{ form.perms_funding() }}
</td>
<td>
{{ form.perms_reporting() }}
</td>
<td>
{{ form.perms_portfolio_mgmt() }}
</td>
</tbody>
</table>
</div>
</div>

View File

@@ -9,7 +9,7 @@
{% if not portfolio.members %}
{% set user_can_invite = user_can(permissions.ASSIGN_AND_UNASSIGN_ATAT_ROLE) %}
{% set user_can_invite = user_can(permissions.CREATE_PORTFOLIO_USERS) %}
{{ EmptyState(
'There are currently no members in this Portfolio.',
@@ -29,7 +29,6 @@
id="search-template"
class='member-list'
v-bind:members='{{ members | tojson}}'
v-bind:role_choices='{{ role_choices | tojson}}'
v-bind:status_choices='{{ status_choices | tojson}}'>
<div>
<form class='search-bar' @submit.prevent>
@@ -50,17 +49,6 @@
{% endfor %}
</select>
</div>
<div class='usa-input'>
<label for='filter-role'>Filter members by role</label>
<select v-model="role" id="filter-role" name="filter-role">
<option value="" selected disabled>Filter by role</option>
<option value="all">View All</option>
{% for role in role_choices %}
<option value='{{ role.name }}'>{{ role.display_name }}</option>
{% endfor %}
</select>
</div>
</div>
</form>

View File

@@ -22,11 +22,33 @@
{{ TextInput(form.last_name) }}
{{ TextInput(form.email,placeholder='jane@mail.mil', validation='email') }}
{{ TextInput(form.dod_id,placeholder='10-digit number on the back of the CAC', validation='dodId') }}
{{ Selector(form.portfolio_role) }}
<table>
<thead>
<tr>
<th>{{ "portfolios.members.permissions.app_mgmt" | translate }}</th>
<th>{{ "portfolios.members.permissions.funding" | translate }}</th>
<th>{{ "portfolios.members.permissions.reporting" | translate }}</th>
<th>{{ "portfolios.members.permissions.portfolio_mgmt" | translate }}</th>
</tr>
</thead>
<tbody>
<td>
{{ form.perms_app_mgmt() }}
</td>
<td>
{{ form.perms_funding() }}
</td>
<td>
{{ form.perms_reporting() }}
</td>
<td>
{{ form.perms_portfolio_mgmt() }}
</td>
</tbody>
</table>
</div>
</div>
<div class='action-group'>
<button class="usa-button usa-button-big usa-button-primary" tabindex="0">Add User</button>
<a href='{{ url_for("portfolios.portfolio_members", portfolio_id=portfolio.id) }}' class='action-group__action icon-link'>

View File

@@ -134,7 +134,7 @@
{% if not portfolio.applications %}
{% set can_create_applications = user_can(permissions.ADD_APPLICATION_IN_PORTFOLIO) %}
{% set can_create_applications = user_can(permissions.CREATE_APPLICATION) %}
{% set message = 'This portfolio has no cloud environments set up, so there is no spending data to report. Create an application with some cloud environments to get started.'
if can_create_applications
else 'This portfolio has no cloud environments set up, so there is no spending data to report. Contact the portfolio owner to set up some cloud environments.'