67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
import { useAuth } from "@/app/auth/AuthProvider.jsx";
|
|
import { PERMISSIONS } from "@/app/permissions";
|
|
|
|
export function useCountryAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canCreate: can(PERMISSIONS.countryCreate),
|
|
canStatus: can(PERMISSIONS.countryStatus),
|
|
canUpdate: can(PERMISSIONS.countryUpdate),
|
|
canView: can(PERMISSIONS.countryView),
|
|
};
|
|
}
|
|
|
|
export function useRegionAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canCreate: can(PERMISSIONS.regionCreate),
|
|
canStatus: can(PERMISSIONS.regionStatus),
|
|
canUpdate: can(PERMISSIONS.regionUpdate),
|
|
canView: can(PERMISSIONS.regionView),
|
|
};
|
|
}
|
|
|
|
export function useAgencyAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canCreate: can(PERMISSIONS.agencyCreate),
|
|
canDelete: can(PERMISSIONS.agencyDelete),
|
|
canStatus: can(PERMISSIONS.agencyStatus),
|
|
canView: can(PERMISSIONS.agencyView),
|
|
};
|
|
}
|
|
|
|
export function useHostAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canView: can(PERMISSIONS.hostView),
|
|
};
|
|
}
|
|
|
|
export function useBDAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canCreate: can(PERMISSIONS.bdCreate),
|
|
canUpdate: can(PERMISSIONS.bdUpdate),
|
|
canView: can(PERMISSIONS.bdView),
|
|
};
|
|
}
|
|
|
|
export function useCoinSellerAbilities() {
|
|
const { can } = useAuth();
|
|
|
|
return {
|
|
canCreate: can(PERMISSIONS.coinSellerCreate),
|
|
canExchangeRate: can(PERMISSIONS.coinSellerExchangeRate),
|
|
canLedger: can(PERMISSIONS.coinSellerLedgerView),
|
|
canStockCredit: can(PERMISSIONS.coinSellerStockCredit),
|
|
canUpdate: can(PERMISSIONS.coinSellerUpdate),
|
|
canView: can(PERMISSIONS.coinSellerView),
|
|
};
|
|
}
|