A Pen by Alex Weissman

Thumbnail
This awesome code was written by alexweissman, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright alexweissman ©

Technologies

  • HTML
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Alex Weissman</title>
  
  
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>

  
  
</head>

<body>

  <div style="display: block;" class="modal fade in" role="dialog">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">Manage Permissions</h4>
      </div>
      <div class="modal-body">
        <div class="alerts-modal">
        </div>
        <form novalidate="novalidate" class="js-form" method="PUT" action="http://localhost/userfrosting/public/api/roles/r/group-admin/permissions">
          <input name="csrf_name" value="csrf587ff652548cc" type="hidden">
          <input name="csrf_value" value="796ec9e4daafcf8905349fcfff64d6d9" type="hidden">
          <div class="js-form-alerts">
          </div>
          <div class="js-form-permissions uf-collection">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Description</th>
                  <th>Hook/Conditions</th>
                  <th>Remove</th>
                </tr>
              </thead>
              <tbody>
                <tr class="uf-collection-row">
                  <td>
                    Create user
                    <input name="value[0][permission_id]" value="2" type="hidden">
                  </td>
                  <td>
                    Create a new user in your own group and assign default roles.
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>create_user</code>
                    </div>
                    <div>
                      ↳ <code>always()</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    Edit group user
                    <input name="value[1][permission_id]" value="9" type="hidden">
                  </td>
                  <td>
                    Edit users in your own group who are not Site or Group Administrators, except yourself.
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>update_user_field</code>
                    </div>
                    <div>
                      ↳ <code>equals_num(self.group_id,user.group_id) &amp;&amp; !is_master(user.id) &amp;&amp; !has_role(user.id,2) &amp;&amp; (!has_role(user.id,3) || equals_num(self.id,user.id)) &amp;&amp; subset(fields,['name','email','locale','flag_enabled','flag_verified','password'])</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    Admin dashboard
                    <input name="value[2][permission_id]" value="12" type="hidden">
                  </td>
                  <td>
                    View the administrative dashboard.
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>uri_dashboard</code>
                    </div>
                    <div>
                      ↳ <code>always()</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    View own group
                    <input name="value[3][permission_id]" value="14" type="hidden">
                  </td>
                  <td>
                    View the group page of your own group.
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>uri_group</code>
                    </div>
                    <div>
                      ↳ <code>equals_num(self.group_id,group.id)</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    View user
                    <input name="value[4][permission_id]" value="17" type="hidden">
                  </td>
                  <td>
                    View the user page of any user in your group, except the master user and Site and Group Administrators (except yourself).
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>uri_user</code>
                    </div>
                    <div>
                      ↳ <code>equals_num(self.group_id,user.group_id) &amp;&amp; !is_master(user.id) &amp;&amp; !has_role(user.id,2) &amp;&amp; (!has_role(user.id,3) || equals_num(self.id,user.id))</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    View group
                    <input name="value[5][permission_id]" value="20" type="hidden">
                  </td>
                  <td>
                    View certain properties of your own group.
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>view_group_field</code>
                    </div>
                    <div>
                      ↳ <code>equals_num(self.group_id,group.id) &amp;&amp; in(property,['name','icon','slug','description','users'])</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
                <tr class="uf-collection-row">
                  <td>
                    View user
                    <input name="value[6][permission_id]" value="22" type="hidden">
                  </td>
                  <td>
                    View certain properties of any user in your own group, except the master user and Site and Group Administrators (except yourself).
                  </td>
                  <td class="uf-collection-col-wrap">
                    <div>
                      <code>view_user_field</code>
                    </div>
                    <div>
                      ↳ <code>equals_num(self.group_id,user.group_id) &amp;&amp; !is_master(user.id) &amp;&amp; !has_role(user.id,2) &amp;&amp; (!has_role(user.id,3) || equals_num(self.id,user.id)) &amp;&amp; in(property,['user_name','name','email','locale','roles','group','activities'])</code>
                    </div>
                  </td>
                  <td>
                    <button type="button" class="btn btn-sm btn-danger js-delete-row" title="Delete"> <i class="fa fa-times"></i> </button>
                  </td>
                </tr>
              </tbody>
            </table>
            <div class="padding-bottom">
              <label>Assign new permission:</label>
              <select aria-hidden="true" tabindex="-1" class="form-control select2 js-select-new select2-hidden-accessible" type="text">
            <option></option>
            </select><span style="width: 100%;" dir="ltr" class="select2 select2-container select2-container--bootstrap"><span class="selection"><span aria-labelledby="select2-q2xh-container" tabindex="0" class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false"><span id="select2-q2xh-container" class="select2-selection__rendered"><span class="select2-selection__placeholder">Select a permission</span></span>
              <span
                class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
                </span>
                </span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
            </div>
          </div>
          <br>
          <div class="row">
            <div class="col-xs-12 col-sm-6">
              <div class="vert-pad">
                <button type="submit" class="btn btn-block btn-lg btn-success">
                    Update permissions
                </button>
              </div>
            </div>
            <div class="col-xs-12 col-sm-3 pull-right">
              <div class="vert-pad">
                <button type="button" class="btn btn-block btn-lg btn-link" data-dismiss="modal">Cancel</button>
              </div>
            </div>
          </div>
        </form>

        <!-- Include validation rules -->
        <script>
          var page = null;
        </script>
      </div>
    </div>
  </div>
</div>
<div class="modal-backdrop fade in"></div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>

  

</body>

</html>

Comments