-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init role / roleclasspermission / roleisntancepermission models
- Loading branch information
Showing
9 changed files
with
336 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import BaseEntity, { BaseEntityArgs } from './BaseEntity'; | ||
|
||
export interface ProviderRoleDetails {} | ||
|
||
export interface KeycloakRoleRepresentation extends ProviderRoleDetails { | ||
id?: string; | ||
name?: string; | ||
description?: string; | ||
scopeParamRequired?: boolean; | ||
composite?: boolean; | ||
// TODO Recheck this type | ||
composites?: string; | ||
clientRole?: boolean; | ||
containerId?: string; | ||
attributes?: { | ||
[key: string]: string[]; | ||
}; | ||
} | ||
|
||
export interface RoleArgs<T extends ProviderRoleDetails = KeycloakRoleRepresentation> extends BaseEntityArgs { | ||
authProviderId?: string; | ||
providerDetails?: T; | ||
} | ||
|
||
export default class Role<T extends ProviderRoleDetails = KeycloakRoleRepresentation> extends BaseEntity { | ||
authProviderId?: string; | ||
providerDetails?: T; | ||
|
||
constructor({ id, created, modified, authProviderId, providerDetails }: RoleArgs<T>) { | ||
super({ id, created, modified }); | ||
|
||
this.authProviderId = authProviderId; | ||
this.providerDetails = providerDetails; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Role from '../Role'; | ||
import ClassPermission, { ClassPermissionArgs } from './ClassPermission'; | ||
|
||
export interface RoleClassPermissionArgs extends ClassPermissionArgs { | ||
role: Role; | ||
} | ||
|
||
export default class RoleClassPermission extends ClassPermission { | ||
role: Role; | ||
|
||
constructor({ id, created, modified, className, permission, role }: RoleClassPermissionArgs) { | ||
super({ id, created, modified, className, permission }); | ||
|
||
this.role = role; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Role from '../Role'; | ||
import InstancePermission, { InstancePermissionArgs } from './InstancePermission'; | ||
|
||
export interface RoleInstancePermissionArgs extends InstancePermissionArgs { | ||
role: Role; | ||
} | ||
|
||
export default class RoleInstancePermission extends InstancePermission { | ||
role: Role; | ||
|
||
constructor({ id, created, modified, entityId, permission, role }: RoleInstancePermissionArgs) { | ||
super({ id, created, modified, entityId, permission }); | ||
|
||
this.role = role; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.