You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by scottyaslan <gi...@git.apache.org> on 2016/11/08 18:41:47 UTC

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

GitHub user scottyaslan opened a pull request:

    https://github.com/apache/nifi/pull/1188

    [NIFI-2926] add policy action item to the user table and add user cen\u2026

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    
    \u2026tric policy dialog with user policy listing table compolete with GoTo action.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/scottyaslan/nifi NIFI-2926

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/1188.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1188
    
----
commit 4c441a7b5c57bbe1be6d08127965f67db8ed161e
Author: Scott Aslan <sc...@gmail.com>
Date:   2016-11-08T18:20:51Z

    [NIFI-2926] add policy action item to the user table and add user centric policy dialog with user policy listing table compolete with GoTo action.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1188: [NIFI-2926] add policy action item to the user table and a...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/1188
  
    @mcgilman @scottyaslan I've reviewed this and tested that the functionality works as expected. +1 merged to master. Thanks for knocking this out - will definitely be a useful feature.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by scottyaslan <gi...@git.apache.org>.
Github user scottyaslan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87598252
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -470,6 +470,214 @@ nf.UsersTable = (function () {
         };
     
         /**
    +     * Initializes the user policies dialog.
    +     */
    +    var initUserPoliciesDialog = function () {
    +        $('#user-policies-dialog').modal({
    +            headerText: 'User Policies',
    +            buttons: [{
    +                buttonText: 'Close',
    +                color: {
    +                    base: '#728E9B',
    +                    hover: '#004849',
    +                    text: '#ffffff'
    +                },
    +                handler: {
    +                    click: function () {
    +                        //TODO: some work
    +
    +                        $('#user-policies-dialog').modal('hide');
    +                    }
    +                }
    +            }]
    +        });
    +    };
    +
    +    /**
    +     * Generates a human readable global policy strung.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var globalResourceParser = function (dataContext) {
    +        return 'Global policy to ' +
    +            nf.Common.getPolicyTypeListing(nf.Common.substringAfterFirst(dataContext.component.resource, '/')).text;
    +    };
    +
    +    /**
    +     * Generates a human readable component policy string.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var componentResourceParser = function (dataContext) {
    +        var resource = dataContext.component.resource;
    +        var policyLabel = '';
    +
    +        //determine policy type
    +        if (resource.startsWith('/policies')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/policies');
    +            policyLabel += 'Admin policy for ';
    +        } else if (resource.startsWith('/data-transfer')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data-transfer');
    +            policyLabel += 'Site to site policy for ';
    +        } else if (resource.startsWith('/data')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data');
    +            policyLabel += 'Data policy for ';
    +        } else {
    +            policyLabel += 'Component policy for ';
    +        }
    +
    +        if (resource.startsWith('/processors')) {
    +            policyLabel += 'processor ';
    +        } else if (resource.startsWith('/controller-services')) {
    +            policyLabel += 'controller services ';
    +        } else if (resource.startsWith('/funnels')) {
    +            policyLabel += 'funnel ';
    +        } else if (resource.startsWith('/input-ports')) {
    +            policyLabel += 'input port ';
    +        } else if (resource.startsWith('/labels')) {
    +            policyLabel += 'label ';
    +        } else if (resource.startsWith('/output-ports')) {
    +            policyLabel += 'output port ';
    +        } else if (resource.startsWith('/process-groups')) {
    +            policyLabel += 'process group ';
    +        } else if (resource.startsWith('/remote-process-groups')) {
    +            policyLabel += 'remote process group ';
    +        } else if (resource.startsWith('/reporting-tasks')) {
    +            policyLabel += 'reporting task ';
    +        } else if (resource.startsWith('/templates')) {
    +            policyLabel += 'template ';
    +        }
    +
    +        if (dataContext.component.componentReference.permissions.canRead === true) {
    +            policyLabel += dataContext.component.componentReference.component.name;
    --- End diff --
    
    Maybe bold or italicized? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1188: [NIFI-2926] add policy action item to the user table and a...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/1188
  
    @mcgilman I'd be happy to review this if you need another reviewer given that you and @scottyaslan have both provided commits for this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87588152
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/users/user-policies-dialog.jsp ---
    @@ -0,0 +1,23 @@
    +<%--
    + Licensed to the Apache Software Foundation (ASF) under one or more
    +  contributor license agreements.  See the NOTICE file distributed with
    +  this work for additional information regarding copyright ownership.
    +  The ASF licenses this file to You under the Apache License, Version 2.0
    +  (the "License"); you may not use this file except in compliance with
    +  the License.  You may obtain a copy of the License at
    +      http://www.apache.org/licenses/LICENSE-2.0
    +  Unless required by applicable law or agreed to in writing, software
    +  distributed under the License is distributed on an "AS IS" BASIS,
    +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +  See the License for the specific language governing permissions and
    +  limitations under the License.
    +--%>
    +<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
    +<div id="user-policies-dialog" class="hidden large-dialog">
    +    <div class="dialog-content">
    +        <div id="user-policy-message">
    +            NOTE: Due to the nature of user policies (specifically inheritance) only top level policies are available.
    --- End diff --
    
    Thoughts on updating this note to read:
    
    > Listing includes all policies for the selected user. Some policies may be inherited by descendant components unless explicitly overridden.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by scottyaslan <gi...@git.apache.org>.
Github user scottyaslan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87601007
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -524,6 +732,10 @@ nf.UsersTable = (function () {
                     markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>';
                 }
     
    +            if (nf.Common.isDefinedAndNotNull(dataContext.component.accessPolicies)) {
    --- End diff --
    
    ah....Right bc the accessPolicies are an array...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87585264
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -470,6 +470,214 @@ nf.UsersTable = (function () {
         };
     
         /**
    +     * Initializes the user policies dialog.
    +     */
    +    var initUserPoliciesDialog = function () {
    +        $('#user-policies-dialog').modal({
    +            headerText: 'User Policies',
    +            buttons: [{
    +                buttonText: 'Close',
    +                color: {
    +                    base: '#728E9B',
    +                    hover: '#004849',
    +                    text: '#ffffff'
    +                },
    +                handler: {
    +                    click: function () {
    +                        //TODO: some work
    +
    +                        $('#user-policies-dialog').modal('hide');
    +                    }
    +                }
    +            }]
    +        });
    +    };
    +
    +    /**
    +     * Generates a human readable global policy strung.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var globalResourceParser = function (dataContext) {
    +        return 'Global policy to ' +
    +            nf.Common.getPolicyTypeListing(nf.Common.substringAfterFirst(dataContext.component.resource, '/')).text;
    +    };
    +
    +    /**
    +     * Generates a human readable component policy string.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var componentResourceParser = function (dataContext) {
    +        var resource = dataContext.component.resource;
    +        var policyLabel = '';
    +
    +        //determine policy type
    +        if (resource.startsWith('/policies')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/policies');
    +            policyLabel += 'Admin policy for ';
    +        } else if (resource.startsWith('/data-transfer')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data-transfer');
    +            policyLabel += 'Site to site policy for ';
    +        } else if (resource.startsWith('/data')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data');
    +            policyLabel += 'Data policy for ';
    +        } else {
    +            policyLabel += 'Component policy for ';
    +        }
    +
    +        if (resource.startsWith('/processors')) {
    +            policyLabel += 'processor ';
    +        } else if (resource.startsWith('/controller-services')) {
    +            policyLabel += 'controller services ';
    +        } else if (resource.startsWith('/funnels')) {
    +            policyLabel += 'funnel ';
    +        } else if (resource.startsWith('/input-ports')) {
    +            policyLabel += 'input port ';
    +        } else if (resource.startsWith('/labels')) {
    +            policyLabel += 'label ';
    +        } else if (resource.startsWith('/output-ports')) {
    +            policyLabel += 'output port ';
    +        } else if (resource.startsWith('/process-groups')) {
    +            policyLabel += 'process group ';
    +        } else if (resource.startsWith('/remote-process-groups')) {
    +            policyLabel += 'remote process group ';
    +        } else if (resource.startsWith('/reporting-tasks')) {
    +            policyLabel += 'reporting task ';
    +        } else if (resource.startsWith('/templates')) {
    +            policyLabel += 'template ';
    +        }
    +
    +        if (dataContext.component.componentReference.permissions.canRead === true) {
    +            policyLabel += dataContext.component.componentReference.component.name;
    +        } else {
    +            policyLabel += '<span class="unset">' + dataContext.component.componentReference.id + '</span>'
    +        }
    +
    +        return policyLabel;
    +    };
    +
    +    /**
    +     * Initializes the user policies table.
    +     */
    +    var initUserPoliciesTable = function () {
    +
    +        // function for formatting the human readable name of the policy
    +        var policyDisplayNameFormatter = function (row, cell, value, columnDef, dataContext) {
    +            // if the user has permission to the policy
    +            if (dataContext.permissions.canRead === true) {
    +                // check if Global policy
    +                if (nf.Common.isUndefinedOrNull(dataContext.component.componentReference)) {
    +                    return globalResourceParser(dataContext);
    +                }
    +                // not a global policy... check if user has access to the component reference
    +                return componentResourceParser(dataContext);
    +            } else {
    +                return '<span class="unset">' + dataContext.id + '</span>';
    +            }
    +        };
    +
    +        // function for formatting the actions column
    +        var actionsFormatter = function (row, cell, value, columnDef, dataContext) {
    +            var markup = '';
    +
    +            if (dataContext.permissions.canRead === true) {
    +                if (nf.Common.isDefinedAndNotNull(dataContext.component.componentReference)) {
    +                    markup += '<div title="Go To" class="pointer go-to-user-policies fa fa-long-arrow-right" style="float: left;"></div>';
    +                }
    +            }
    +
    +            return markup;
    +        };
    +
    +        // function for formatting the action column
    +        var actionFormatter = function (row, cell, value, columnDef, dataContext) {
    +            var markup = '';
    +
    +            if (dataContext.permissions.canRead === true) {
    +                markup += dataContext.component.action;
    +            }
    +
    +            return markup;
    +        };
    +
    +        var userPoliciesColumns = [
    +            {id: 'policy', name: 'Policy', sortable: true, resizable: true, formatter: policyDisplayNameFormatter, width: 150},
    +            {id: 'action', name: 'Action', sortable: true, resizable: false, formatter: actionFormatter, width: 50}
    +        ];
    +
    +        // add the actions if we're in the shell
    +        if ((top !== window) && nf.Common.canAccessPolicies()) {
    --- End diff --
    
    Policies will have their own specific permissions. No need to check if the user can access all policies here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/1188


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87585309
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -470,6 +470,214 @@ nf.UsersTable = (function () {
         };
     
         /**
    +     * Initializes the user policies dialog.
    +     */
    +    var initUserPoliciesDialog = function () {
    +        $('#user-policies-dialog').modal({
    +            headerText: 'User Policies',
    +            buttons: [{
    +                buttonText: 'Close',
    +                color: {
    +                    base: '#728E9B',
    +                    hover: '#004849',
    +                    text: '#ffffff'
    +                },
    +                handler: {
    +                    click: function () {
    +                        //TODO: some work
    --- End diff --
    
    Any more work needed here? ;)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87585784
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -524,6 +732,10 @@ nf.UsersTable = (function () {
                     markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>';
                 }
     
    +            if (nf.Common.isDefinedAndNotNull(dataContext.component.accessPolicies)) {
    --- End diff --
    
    Should probably show the key when the accessPolicies are not empty. I think its just `!nf.Common.isEmpty(dataContext.component.accessPolicies)`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1188: [NIFI-2926] add policy action item to the user table and a...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on the issue:

    https://github.com/apache/nifi/pull/1188
  
    @markap14 Sounds great. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87591163
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js ---
    @@ -657,7 +695,7 @@ nf.Common = (function () {
                         return nf.Common.escapeHtml(value);
                     }
                 } else {
    -                return '<span class="unset" style="font-size: 13px; padding-top: 2px;">No value previously set</span>';
    +                return '<span class="unset" style="font-size: 13px; padding-top: 2px;">No value set</span>';
    --- End diff --
    
    Can we also update the `Empty string previously set` above?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1188: [NIFI-2926] add policy action item to the user table and a...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on the issue:

    https://github.com/apache/nifi/pull/1188
  
    Reviewing...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by scottyaslan <gi...@git.apache.org>.
Github user scottyaslan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87600753
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -470,6 +470,214 @@ nf.UsersTable = (function () {
         };
     
         /**
    +     * Initializes the user policies dialog.
    +     */
    +    var initUserPoliciesDialog = function () {
    +        $('#user-policies-dialog').modal({
    +            headerText: 'User Policies',
    +            buttons: [{
    +                buttonText: 'Close',
    +                color: {
    +                    base: '#728E9B',
    +                    hover: '#004849',
    +                    text: '#ffffff'
    +                },
    +                handler: {
    +                    click: function () {
    +                        //TODO: some work
    --- End diff --
    
    haha...nope


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by scottyaslan <gi...@git.apache.org>.
Github user scottyaslan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87595909
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/users/user-policies-dialog.jsp ---
    @@ -0,0 +1,23 @@
    +<%--
    + Licensed to the Apache Software Foundation (ASF) under one or more
    +  contributor license agreements.  See the NOTICE file distributed with
    +  this work for additional information regarding copyright ownership.
    +  The ASF licenses this file to You under the Apache License, Version 2.0
    +  (the "License"); you may not use this file except in compliance with
    +  the License.  You may obtain a copy of the License at
    +      http://www.apache.org/licenses/LICENSE-2.0
    +  Unless required by applicable law or agreed to in writing, software
    +  distributed under the License is distributed on an "AS IS" BASIS,
    +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +  See the License for the specific language governing permissions and
    +  limitations under the License.
    +--%>
    +<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
    +<div id="user-policies-dialog" class="hidden large-dialog">
    +    <div class="dialog-content">
    +        <div id="user-policy-message">
    +            NOTE: Due to the nature of user policies (specifically inheritance) only top level policies are available.
    --- End diff --
    
    I like it! Do you think we should leave the "NOTE:" in front of it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1188: [NIFI-2926] add policy action item to the user tabl...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1188#discussion_r87586238
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/users/nf-users-table.js ---
    @@ -470,6 +470,214 @@ nf.UsersTable = (function () {
         };
     
         /**
    +     * Initializes the user policies dialog.
    +     */
    +    var initUserPoliciesDialog = function () {
    +        $('#user-policies-dialog').modal({
    +            headerText: 'User Policies',
    +            buttons: [{
    +                buttonText: 'Close',
    +                color: {
    +                    base: '#728E9B',
    +                    hover: '#004849',
    +                    text: '#ffffff'
    +                },
    +                handler: {
    +                    click: function () {
    +                        //TODO: some work
    +
    +                        $('#user-policies-dialog').modal('hide');
    +                    }
    +                }
    +            }]
    +        });
    +    };
    +
    +    /**
    +     * Generates a human readable global policy strung.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var globalResourceParser = function (dataContext) {
    +        return 'Global policy to ' +
    +            nf.Common.getPolicyTypeListing(nf.Common.substringAfterFirst(dataContext.component.resource, '/')).text;
    +    };
    +
    +    /**
    +     * Generates a human readable component policy string.
    +     *
    +     * @param dataContext
    +     * @returns {string}
    +     */
    +    var componentResourceParser = function (dataContext) {
    +        var resource = dataContext.component.resource;
    +        var policyLabel = '';
    +
    +        //determine policy type
    +        if (resource.startsWith('/policies')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/policies');
    +            policyLabel += 'Admin policy for ';
    +        } else if (resource.startsWith('/data-transfer')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data-transfer');
    +            policyLabel += 'Site to site policy for ';
    +        } else if (resource.startsWith('/data')) {
    +            resource = nf.Common.substringAfterFirst(resource, '/data');
    +            policyLabel += 'Data policy for ';
    +        } else {
    +            policyLabel += 'Component policy for ';
    +        }
    +
    +        if (resource.startsWith('/processors')) {
    +            policyLabel += 'processor ';
    +        } else if (resource.startsWith('/controller-services')) {
    +            policyLabel += 'controller services ';
    +        } else if (resource.startsWith('/funnels')) {
    +            policyLabel += 'funnel ';
    +        } else if (resource.startsWith('/input-ports')) {
    +            policyLabel += 'input port ';
    +        } else if (resource.startsWith('/labels')) {
    +            policyLabel += 'label ';
    +        } else if (resource.startsWith('/output-ports')) {
    +            policyLabel += 'output port ';
    +        } else if (resource.startsWith('/process-groups')) {
    +            policyLabel += 'process group ';
    +        } else if (resource.startsWith('/remote-process-groups')) {
    +            policyLabel += 'remote process group ';
    +        } else if (resource.startsWith('/reporting-tasks')) {
    +            policyLabel += 'reporting task ';
    +        } else if (resource.startsWith('/templates')) {
    +            policyLabel += 'template ';
    +        }
    +
    +        if (dataContext.component.componentReference.permissions.canRead === true) {
    +            policyLabel += dataContext.component.componentReference.component.name;
    --- End diff --
    
    Thoughts on emphasizing the component name? In some example it seems to blend in with the rest of the string.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---