mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
manager can create memebrs & credit wallets
This commit is contained in:
parent
e4f5a0f833
commit
18895b6a85
@ -229,9 +229,12 @@
|
||||
<ng-include src="'<%= asset_path "wallet/show.html" %>'"></ng-include>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="col-sm-4 text-center">
|
||||
<div class="col-sm-4 text-center" ng-hide="user.id === currentUser.id">
|
||||
<button type="button" class="btn btn-warning m-t m-b" ng-click="createWalletCreditModal(user, wallet)" translate>{{ 'app.admin.members_edit.to_credit' }}</button>
|
||||
</div>
|
||||
<p class="col-sm-4 alert alert-info" ng-show="user.id === currentUser.id" translate>
|
||||
{{ 'app.admin.members_edit.cannot_credit_own_wallet' }}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-xs-1 col-xs-offset-1 col-md-offset-2 b-l">
|
||||
<section class="heading-actions wrapper">
|
||||
<section class="heading-actions wrapper" ng-show="isAuthorized('admin')">
|
||||
<a role="button" class="btn btn-default b-2x rounded m-t-sm import-members" ui-sref="app.admin.members_import">
|
||||
<i class="fa fa-cloud-upload"></i>
|
||||
</a>
|
||||
@ -30,7 +30,7 @@
|
||||
post-render="setupMembersTour">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<uib-tabset justified="true" active="tabs.active">
|
||||
<uib-tabset justified="true" active="tabs.active" ng-show="isAuthorized('admin')">
|
||||
|
||||
<uib-tab heading="{{ 'app.admin.members.users' | translate }}" index="0">
|
||||
<ng-include src="'<%= asset_path "admin/members/users.html" %>'"></ng-include>
|
||||
@ -48,6 +48,10 @@
|
||||
<div ui-view="authentification"></div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
|
||||
<div ng-show="isAuthorized('manager')">
|
||||
<ng-include src="'<%= asset_path "admin/members/users.html" %>'"></ng-include>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button type="button" class="btn btn-warning m-t m-b" ui-sref="app.admin.members_new" ng-show="isAuthorized('admin')" translate>
|
||||
<button type="button" class="btn btn-warning m-t m-b" ui-sref="app.admin.members_new" translate>
|
||||
{{ 'app.admin.members.add_a_new_member' }}
|
||||
</button>
|
||||
<div class="pull-right exports-buttons" ng-show="isAuthorized('admin')">
|
||||
|
@ -1,18 +1,18 @@
|
||||
<uib-tabset justified="true" active="tabs.sub" class="m-t">
|
||||
|
||||
<uib-tab classes="level-2-tab" heading="{{ 'app.admin.members.members' | translate }}" index="0">
|
||||
<uib-tab classes="{{isAuthorized('admin') ? 'level-2-tab' : ''}}" heading="{{ 'app.admin.members.members' | translate }}" index="0">
|
||||
<ng-include src="'<%= asset_path "admin/members/members.html" %>'"></ng-include>
|
||||
</uib-tab>
|
||||
|
||||
<uib-tab classes="level-2-tab" heading="{{ 'app.admin.members.administrators' | translate }}" class="admins-tab" index="1">
|
||||
<uib-tab classes="{{isAuthorized('admin') ? 'level-2-tab' : ''}}" heading="{{ 'app.admin.members.administrators' | translate }}" class="admins-tab" index="1">
|
||||
<ng-include src="'<%= asset_path "admin/members/administrators.html" %>'"></ng-include>
|
||||
</uib-tab>
|
||||
|
||||
<uib-tab classes="level-2-tab" heading="{{ 'app.admin.members.managers' | translate }}" class="admins-tab" index="2">
|
||||
<uib-tab classes="{{isAuthorized('admin') ? 'level-2-tab' : ''}}" heading="{{ 'app.admin.members.managers' | translate }}" class="admins-tab" index="2">
|
||||
<ng-include src="'<%= asset_path "admin/members/managers.html" %>'"></ng-include>
|
||||
</uib-tab>
|
||||
|
||||
<uib-tab classes="level-2-tab" heading="{{ 'app.admin.members.partners' | translate }}" class="admins-tab" index="3" ng-show="isAuthorized('admin')">
|
||||
<uib-tab classes="{{isAuthorized('admin') ? 'level-2-tab' : ''}}" heading="{{ 'app.admin.members.partners' | translate }}" class="admins-tab" index="3" ng-show="isAuthorized('admin')">
|
||||
<ng-include src="'<%= asset_path "admin/members/partners.html" %>'"></ng-include>
|
||||
</uib-tab>
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<div>
|
||||
|
||||
<section class="heading">
|
||||
<div class="row no-gutter">
|
||||
<ng-include src="'<%= asset_path "dashboard/nav.html" %>'"></ng-include>
|
||||
@ -7,7 +6,6 @@
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<div class="row no-gutter">
|
||||
<div class="col-md-12 m m-t-lg">
|
||||
<ng-include src="'<%= asset_path "wallet/show.html" %>'"></ng-include>
|
||||
@ -17,5 +15,4 @@
|
||||
<ng-include src="'<%= asset_path "wallet/transactions.html" %>'"></ng-include>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -38,7 +38,7 @@ class API::MembersController < API::ApiController
|
||||
end
|
||||
|
||||
def create
|
||||
authorize User
|
||||
authorize :user, :create_member?
|
||||
|
||||
@member = User.new(user_params.permit!)
|
||||
members_service = Members::MembersService.new(@member)
|
||||
|
@ -33,7 +33,7 @@ class UserPolicy < ApplicationPolicy
|
||||
end
|
||||
end
|
||||
|
||||
%w[list index].each do |action|
|
||||
%w[list index create_member].each do |action|
|
||||
define_method "#{action}?" do
|
||||
user.admin? || user.manager?
|
||||
end
|
||||
|
@ -9,6 +9,6 @@ class WalletPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def credit?
|
||||
user.admin?
|
||||
user.admin? || (user.manager? && user != record.user)
|
||||
end
|
||||
end
|
||||
|
@ -762,6 +762,7 @@ en:
|
||||
a_problem_occurred_while_taking_the_subscription: "A problem occurred while taking the subscription"
|
||||
wallet: "Wallet"
|
||||
to_credit: 'Credit'
|
||||
cannot_credit_own_wallet: "You cannot credit your own wallet. Please ask another manager or an administrator to credit your wallet."
|
||||
#add a new administrator to the platform
|
||||
admins_new:
|
||||
add_an_administrator: "Add an administrator"
|
||||
|
Loading…
Reference in New Issue
Block a user