Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nocobase
Commits
dd6f0a6d
Commit
dd6f0a6d
authored
3 years ago
by
chenos
Browse files
Options
Download
Email Patches
Plain Diff
fix(cli): skip when role does not exist
parent
7c21c5cf
main
0.7
0.7.6
Dunqing-feat-select-m2o-next
audit-logs
auditlogs
changed-with-associations
chore/error-message
doc/api-database
doc/db-repository
doc/dev-res-action
doc/new-user-manual
doc/plugin-workflow
doc/relation-repository
example/custom-signup-page
example/util
examples
excel-function
feat-add-block-title-feature
feat-add-default-sort
feat-association-field-block
feat-association-field-features
feat-default-value
feat-fix-time-and-collection-pagination
feat-fk-input
feat-form-validator
feat-kanban-add-description
feat-m2o-sub-form-mode
feat-record-block-initializers-fields-pick
feat-relation-field-uischema
feat/associate-operate
feat/batch-operation
feat/cache
feat/changed-with-associations
feat/collection-inherits
feat/collection-templates
feat/database
feat/dev-ci
feat/field-unique
feat/grap-collection
feat/inherit-collection
feat/logger
feat/plugin-export
feat/plugin-file-manager
feat/plugin-import
feat/plugin-import-2
feat/plugin-manager-0823
feat/plugin-user-groups
feat/plugin-verification
feat/plugin-workflow-collection-field
feat/pm
feat/pnpm-support
feat/reference-check
feat/request-logs
feat/resize-grid-columns
feat/safer-update
feat/submodule-graph-collection
feat/tree-table-block
feat/workflow-request
fix-formula-bug
fix-link-to-default-value
fix-template-with-fields-only
fix-timezone
fix/association-deleted
fix/attachment-upload
fix/block-select-collection-menu
fix/bulk-update-db-locked
fix/collection-manager
fix/collection-manager-0719
fix/collection-manager-del-foreign-key
fix/create-inherits
fix/custom-assign-value
fix/database-find-with-appends
fix/database-view-error
fix/destroy-fields-by-array
fix/docker-ci
fix/export-date
fix/export-percent
fix/form-sys-fields-default-edit-mode
fix/menu-schema
fix/merge-include
fix/plugin-cm
fix/table-data
fix/table-field-overflow
perf/cache-schema
perf/token
pre-release
refactor/client
refactor/plugin-workflow
refactor/plugin-workflow-ui
rollback
table-demo
tree
tree-demo
v0.8.0-alpha.13
v0.8.0-alpha.11
v0.8.0-alpha.9
v0.8.0-alpha.8
v0.8.0-alpha.7
v0.8.0-alpha.6
v0.8.0-alpha.5
v0.8.0-alpha.3
v0.8.0-alpha.2
v0.8.0-alpha.1
v0.7.7-alpha.1
v0.7.6-alpha.2
v0.7.5-alpha.1.1666403334
v0.7.5-alpha.1
v0.7.4-alpha.7
v0.7.4-alpha.4
v0.7.4-alpha.1
v0.7.3-alpha.1
v0.7.2-alpha.2
v0.7.2-alpha.1
v0.7.1-alpha.5
v0.7.1-alpha.4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/plugins/acl/src/model/RoleResourceModel.ts
+7
-2
packages/plugins/acl/src/model/RoleResourceModel.ts
packages/plugins/acl/src/server.ts
+3
-1
packages/plugins/acl/src/server.ts
with
10 additions
and
3 deletions
+10
-3
packages/plugins/acl/src/model/RoleResourceModel.ts
+
7
-
2
View file @
dd6f0a6d
import
{
Database
,
Model
}
from
'
@nocobase/database
'
;
import
{
ACL
,
ACLResource
,
ACLRole
}
from
'
@nocobase/acl
'
;
import
{
RoleResourceActionModel
}
from
'
./RoleResourceActionModel
'
;
import
{
Model
}
from
'
@nocobase/database
'
;
import
{
AssociationFieldsActions
,
GrantHelper
}
from
'
../server
'
;
import
{
RoleResourceActionModel
}
from
'
./RoleResourceActionModel
'
;
export
class
RoleResourceModel
extends
Model
{
async
revoke
(
options
:
{
role
:
ACLRole
;
resourceName
:
string
;
grantHelper
:
GrantHelper
})
{
...
...
@@ -36,6 +36,11 @@ export class RoleResourceModel extends Model {
const
roleName
=
this
.
get
(
'
roleName
'
)
as
string
;
const
role
=
acl
.
getRole
(
roleName
);
if
(
!
role
)
{
console
.
log
(
`
${
roleName
}
role does not exist`
);
return
;
}
// revoke resource of role
await
this
.
revoke
({
role
,
resourceName
,
grantHelper
});
...
...
This diff is collapsed.
Click to expand it.
packages/plugins/acl/src/server.ts
+
3
-
1
View file @
dd6f0a6d
...
...
@@ -180,7 +180,9 @@ export class PluginACL extends Plugin {
this
.
app
.
db
.
on
(
'
rolesResources.afterDestroy
'
,
async
(
model
,
options
)
=>
{
const
role
=
this
.
acl
.
getRole
(
model
.
get
(
'
roleName
'
));
role
.
revokeResource
(
model
.
get
(
'
name
'
));
if
(
role
)
{
role
.
revokeResource
(
model
.
get
(
'
name
'
));
}
});
this
.
app
.
db
.
on
(
'
collections.afterDestroy
'
,
async
(
model
,
options
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help