<h3>User details for {{detailedUser.display_name}}</h3>
<br />

<table  class="table table-condensed table-nohead">
    <tbody>
    <tr><td width="100px">User id</td> <td> {{ detailedUser.user_id }} </td></tr>
    <tr><td>Display Name</td> <td> {{ detailedUser.display_name }} </td></tr>
    <tr><td>Suspended</td> <td> <input type="checkbox" ng-model="detailedUser.suspended" ng-true-value="true" ng-false-value="false" disabled> </td></tr>
    <tr><td>System</td> <td> <input type="checkbox" ng-model="detailedUser.system" ng-true-value="true" ng-false-value="false" disabled> </td></tr>
    <tr><td>Email</td> <td> <a href="mailto: {{ detailedUser.email }}">{{ detailedUser.email }}</a> </td></tr>
    <tr><td>Max buckets</td> <td> {{ detailedUser.max_buckets }} </td></tr>
    <tr>
        <td>User quota</td>
        <td ng-show="detailedUser.user_quota.enabled">
            <div ng-show="detailedUser.user_quota.max_objects>-1">
                max objects :{{detailedUser.user_quota.max_objects}}
            </div>
            <div ng-show="detailedUser.user_quota.max_size_kb >-1">
                max size: {{detailedUser.user_quota.max_size_kb*1024|bytes}}
            </div>
        </td>
        <td ng-hide="detailedUser.user_quota.enabled">
            disabled
        </td>
    </tr>
    <tr>
        <td>Bucket quota</td>
        <td ng-show="detailedUser.bucket_quota.enabled">
             <div ng-show="detailedUser.bucket_quota.max_objects>-1">
                max objects :{{detailedUser.bucket_quota.max_objects}}
            </div>
            <div ng-show="detailedUser.bucket_quota.max_size_kb >-1">
                max size: {{detailedUser.bucket_quota.max_size_kb*1024|bytes}}
            </div>
        </td>
        <td ng-hide="detailedUser.bucket_quota.enabled">
            disabled
        </td>
    </tr>
    <tr><td>OP mask</td> <td> {{ detailedUser.op_mask }} </td></tr>
    <tr><td>Default placement</td> <td> {{ detailedUser.default_placement }} </td></tr>
    <tr><td>Placement tags</td> <td> {{ (detailedUser.placement_tags.length>0) ? (detailedUser.placement_tags|prettifyArray) :'none' }} </td></tr>
    <tr>
        <td>S3 keys <a href="#/createKey/{{detailedUser.user_id}}" ng-show="hasRole('admin_rgw')"><i class="icon-plus-sign closeButton" alt="add key" title="add key"></i></a></td>
        <td>
            <div ng-hide="detailedUser.keys">none</div>
            <table  class="table table-condensed ">
                <tr ng-repeat="key in detailedUser.keys">
                    <td>{{key.user}}</td>
                    <td>{{key.access_key}}<br><span ng-show="hasRole('admin_rgw')">{{key.secret_key}}</span></td>
                    <td width="20" ng-show="hasRole('admin_rgw')"><a ng-click="removeKey(key.access_key)"><i class="icon-remove closeButton" alt="remove key" title="remove key"></i></a></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>Sub users <a href="#/createSubuser/{{detailedUser.user_id}}" ng-show="hasRole('admin_rgw')"><i class="icon-plus-sign closeButton" alt="add subuser" title="add subuser"></i></a></td>
        <td>
            <div ng-hide="detailedUser.subusers">none</div>
            <table  class="table table-condensed ">
                <tr ng-repeat="subuser in detailedUser.subusers">
                    <td>{{subuser.id}}</td>
                    <td>{{subuser.permissions}}</td>
                    <td width="40">
                        <a ng-click="removeSubuser(subuser.id)" ng-show="hasRole('admin_rgw')"><i class="icon-remove closeButton" alt="remove subuser" title="remove subuser"></i></a>
                        <a href="#/createSwiftKey/{{detailedUser.user_id}}/{{subuser.id}}" ng-show="hasRole('admin_rgw')"><i class="icon-bookmark closeButton" alt="add swift key" title="add swift key"></i></a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>Swift Keys</td>
        <td>
            <div ng-hide="detailedUser.swift_keys">none</div>
            <table  class="table table-condensed">
                <tr ng-repeat="key in detailedUser.swift_keys">
                    <td>{{key.user}}</td>
                    <td ng-show="hasRole('admin_rgw')">{{key.secret_key}}</td>
                    <td width="20" ng-show="hasRole('admin_rgw')"><a ng-click="removeSwiftKey(key.user,key.secret_key)"><i class="icon-remove closeButton" alt="remove key" title="remove key"></i></a></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>Caps <a href="#/capabilities/{{detailedUser.user_id}}" ng-show="hasRole('admin_rgw')"><i class="icon-edit closeButton" alt="edit capabilities" title="edit capabilities"></i></a></td>
        <td>
            <div ng-hide="detailedUser.caps">none</div>
            <table  class="table table-condensed ">
                <tr ng-repeat="cap in detailedUser.caps">
                    <td>{{cap.type}}</td>
                    <td>{{cap.perm}}</td>
                </tr>
            </table>
        </td>
    </tr>
    </tbody>
</table>


<div class="button-bar" ng-show="hasRole('admin_rgw')">
    <a href="#/modify/{{detailedUser.user_id}}" class="btn btn-success">Modify</a>
    <a href="#/delete/{{detailedUser.user_id}}/{{detailedUser['display-name']}}" class="btn btn-danger">Delete</a>
    <a href="#/" class="btn btn-default">Close</a>
</div>
