import { reactive } from 'vue'
import useUserStore from '@/store/modules/user'

const usePermission = () => {
    const all_permission = "*:*:*";
    const permissions = useUserStore().permissions

    const hasPermissions = (value) => {
        const hasPermissions = permissions.some(permission => {
            const permissionFlag = value
            return all_permission === permission || permissionFlag.includes(permission)
        })
        return hasPermissions
    }

    return {
        hasPermissions
    }
}

export default usePermission;