Add permissionhandling

@jone