All notable changes to this project will be documented in this file.
8.0.2 (2024-06-16)
8.0.1 (2024-03-27)
8.0.0 (2024-03-27)
accessibleBy
is now just a POJO which hasofType
method to get query for specific type- mongoose
accessibleRecordsPlugin
doesn't throw exception anymore if ability forbids to do an action and instead it sends empty result query to MongoDB
7.2.2 (2024-01-31)
7.2.1 (2023-07-28)
- changes empty result query to be $expr with object, otherwise mongoose throws error (9eae155)
7.2.0 (2023-07-22)
- adds jsdoc comments (#768) (6ca6105)
- adds jsdoc comments to test release trigger (#766) (fcdf8c8)
- removes release testing comments (#767) (67ccbc9)
7.1.3 (2023-05-05)
7.1.2 (2022-10-30)
- fixes type in mongoose error message (1d28496)
7.1.1 (2022-10-30)
- adds unlessCan method to ForbiddenError and reused it mongoose package to construct ForbiddenError (be7ae6a)
7.1.0 (2022-08-28)
- ensure acessible plugins can work with Ability instance that uses classes as SubjectTypes (7e9b634), closes #656
7.0.0 (2022-07-29)
- increased mongoose version to 6.0.13 in order to use 4 generic types in
Model
type
6.0.1 (2022-07-25)
6.0.0 (2021-11-04)
- ensure it's possible to chain
accessibleBy
after anotheraccessibleBy
and combine with otherQuery
methods (5632c53) - package: add repository directory into package.json for all @casl/* packages (#560) (0ef534c)
- updates mongoose and related ts types to v6
5.0.1 (2021-05-12)
- adjusts package tags to improve discoverability (73e88b0)
5.0.0 (2021-05-10)
-
mongoose: migrates
@casl/mongoose
to official mongoose types. This is a breaking change for TypeScript users. What you need to do is tonpm uninstall @types/mongoose
and extend model interfaces by
mongoose.Document
Before
interface Post { title: string; content: string; } const schema = new mongoose.Schema<Post>({ // model definition });
After
import mongoose from "mongoose"; interface Post extends mongoose.Document { title: string; content: string; } const schema = new mongoose.Schema<Post>({ // model definition });
For example, check updated README.md
4.0.2 (2021-04-12)
- mongoose: uses
mongoose
as commonjs module (c98506b)
4.0.1 (2021-02-12)
- changelog: removes unrelated entries from changelog (5437622)
4.0.0 (2021-02-12)
- mongoose: throws
ForbiddenError
instead of returning a hard-coded value when user has not permissions to do some action (917dd01), closes #404
-
mongoose:
accessibleBy
eventually throwsForbiddenError
instead of returning a hard-coded valueBefore:
// ability doesn't allow to read Post const ability = defineAbility(can => can('manage', 'Comment')); try { const items = await Post.accessibleBy(ability, 'read'); console.log(items); // [] } catch (error) { console.error(error); // no error thrown }
After:
// ability doesn't allow to read Post const ability = defineAbility(can => can('manage', 'Comment')); try { const items = await Post.accessibleBy(ability, 'read'); console.log(items); // not reached, because query fails with error } catch (error) { console.error(error); // ForbiddenError thrown }
3.2.2 (2021-01-05)
- mongoose: simplifies types for
toMongoQuery
helper (1615f4b)
3.2.1 (2020-12-28)
3.2.0 (2020-12-26)
- angular: fixes sourcemap generation for the code built by ngc (7715263), closes #387 #382
- package: removes
engine
section that points to npm@6 (eecd12a), closes #417
- esm: adds ESM support for latest Node.js through
exports
prop in package.json (cac2506), closes #331
3.1.0 (2020-08-20)
- mongoose: adds
getFields
option toaccessibleFieldsPlugin
(a93037c)
3.0.3 (2020-06-09)
3.0.2 (2020-04-10)
- mongoose: ensure that terser doesn't mangle reserved required props (83f1d32)
3.0.1 (2020-04-09)
- mongoose: adds support for casl/ability@4 in package.json (ffb887c)
3.0.0 (2020-04-09)
- mongoose: ensures mongoose works with MongoQuery conditions (f92b7df), closes #249
- mongoose: fixes mongoose typings (d320eba), closes #248
- mongoose: adds generics to mongoose types (6cdf82e), closes #256
- mongoose: simplifies generics for mongoose (7ff65f7), closes #107
- mongoose: removes deprecated
permittedFieldsPlugin
useaccessibleFieldsPlugin
instead - typescript: weak hand written declaration files are removed as
@casl/mongoose
has been completely rewritten to TypeScript.
2.3.3 (2020-03-13)
- mongoose: adds missing
index.js
file (804c0dd) - mongoose: makes sure abilityConditions does not override existing
$and
conditions (#273) (c13300f), closes #272
@casl/mongoose-v2.3.2 (2019-09-14)
@casl/mongoose-v2.3.1 (2019-02-10)
@casl/mongoose-v2.3.0 (2018-12-28)
@casl/mongoose-v2.2.2 (2018-11-07)
@casl/mongoose-v2.2.1 (2018-10-14)
@casl/mongoose-v2.2.0 (2018-10-10)
- angular: adding type definitions for accessibleFields (#117) (a00c02b)
- README: changes links to @casl/ability to point to npm package instead to git root [skip ci] (a74086b), closes #102
- react:can: updates typescript declarations (213dcde)
@casl/mongoose-v2.1.2 (2018-07-02)
2.1.1 (2018-05-06)
- mongoose: returns empty result set for Query#count (f89dfb9), closes #52
- typescript: fixes typings (d5fc51c), relates to #18
- mongoose: returns empty result set for Query#count (f89dfb9), closes #52
- typescript: updates d.ts files (d5fc51c), closes #18
- package: adds mongoose plugin
- package: adds MongoDB query builder