Fixing bug in getUserPermission method