@memberjunction/ng-resource-permissions 6.1.4 → 6.2.0-edge.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"resource-permissions.component.js","sourceRoot":"","sources":["../../src/lib/resource-permissions.component.ts","../../src/lib/resource-permissions.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAA4C,MAAM,+BAA+B,CAAC;AACnH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;ICHrE,gCAA0D;;IAA9C,gCAAkB;;;;IAG9B,iCAA6C;IAA5B,gMAAS,wBAAiB,KAAC;IAAC,oBAAI;IAAA,iBAAS;;;;IAYpD,uCAKwB;IAHtB,iVAA0B;IAI5B,iBAAc;;;IALZ,sCAAiB;IACjB,mDAA0B;;;;IAO5B,uCAKwB;IAHtB,iVAA0B;IAI5B,iBAAc;;;IALZ,sCAAiB;IACjB,mDAA0B;;;IAO5B,YACF;;;IADE,kEACF;;;;IAEE,sCAGwB;IADtB,uWAAqC;IAEvC,iBAAc;;;IAHZ,8CAAyB;IACzB,8DAAqC;;;;IA9BzC,AADF,8BAAoC,cACC;IAAA,8BAAc;IAAA,iBAAO;IACxD,sCAGwB;IADtB,kUAA0B;IAE5B,iBAAc;IAmBd,AATA,AATA,oHAA+B,+FASK,4EAS7B;IAGP,qHAA4B;IAO5B,kCAAwL;IAAvK,gMAAS,sBAAe,KAAC;IAA8I,mBAAG;IAC7L,AAD6L,iBAAS,EAChM;;;IAjCF,eAAwB;IAAxB,6CAAwB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BAA4B;cANxC,SAAS;6BACI,KAAK,YACP,yBAAyB;;kBAQlC,KAAK;;kBAIL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAIL,KAAK;;kBAIL,KAAK;;kBAIL,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAML,KAAK;;kFA1DK,4BAA4B","sourcesContent":["import { AfterViewInit, Component, Input } from '@angular/core';\nimport { LogError, RoleInfo, RunView } from '@memberjunction/core';\nimport { ResourcePermissionEngine, MJResourcePermissionEntity, MJUserEntity } from '@memberjunction/core-entities';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\n\n/**\n * Visual component used to display and manage permissions for a resource. You can wrap this in a dialog or display anywhere else within\n * an Angular application or component.\n */\n@Component({\n standalone: false,\n selector: 'mj-resource-permissions',\n templateUrl: './resource-permissions.component.html',\n styleUrls: ['./resource-permissions.component.css']\n})\nexport class ResourcePermissionsComponent extends BaseAngularComponent implements AfterViewInit {\n /**\n * Required: the ID of the resource type record for the specified resource that the permissions are being set for.\n */\n @Input() ResourceTypeID!: string;\n /**\n * Required: the record ID of the resource that the permissions are being set for.\n */ \n @Input() ResourceRecordID!: string;\n /**\n * If set to true, the component will show a Save button to the user and persist the changes to the \n * database when the user clicks the Save button. By default this is off to allow users of the component\n * to wrap the component as desired, and handle the save themselves.\n */\n @Input() ShowSaveButton: boolean = false;\n /**\n * If set to true, the component will show the permission levels to the user. By default this is on. If you have \n * a Resource Type or run-time use case where levels are not relevant, you can turn this off.\n */\n @Input() ShowPermissionLevels: boolean = true;\n /**\n * By default, this component will not show any error messages to the user. \n * If you want to show error messages to the user, set this to true. The component will always throw exceptions when error occur internally.\n */\n @Input() ShowUserErrorMessages: boolean = false;\n /**\n * Allows you to determine if the user is able to add new permissions for the resource.\n */\n @Input() AllowAddPermissions: boolean = true;\n /**\n * Allows you to determine if the user is able to edit existing permissions for the resource.\n */\n @Input() AllowEditPermissions: boolean = true;\n /**\n * Allows you to determine if the user is able to delete existing permissions for the resource.\n */\n @Input() AllowDeletePermissions: boolean = true;\n\n /**\n * List of possible permission levels that can be set for the resource. An array of strings, defaults to ['View', 'Edit', 'Owner']\n */\n @Input() PermissionLevels = ['View', 'Edit', 'Owner']; // these are the possible permission levels\n\n /**\n * Specifies the types of permissions the UI will allow settings for. An array of strings, defaults to ['User', 'Role']\n */\n @Input() PermissionTypes = ['User', 'Role'];\n\n /**\n * This optional input allows you to exclude certain roles from the list of roles that can be selected for permissions. If existing permissions have been created with roles that are in this list they will still be displayed, \n * but the user will not be able to add new permissions with these roles. This is an array of strings with the NAMES of the roles.\n */\n @Input() ExcludedRoleNames: string[] = [];\n\n /**\n * This optional input allows you to exclude certain users from the list of users that can be selected for permissions. If existing permissions have been created with users that are in this list they will still be displayed, \n * but the user will not be able to add new permissions with these users. This is an array of strings with EMAILS.\n */\n @Input() ExcludedUserEmails: string[] = [];\n\n public AllUsers: MJUserEntity[] = [];\n public AllRoles: RoleInfo[] = [];\n\n public SelectedUser: MJUserEntity | null = null;\n public SelectedRole: RoleInfo | null = null;\n public SelectedType: 'User' | 'Role' = 'Role';\n public SelectedPermissionLevel: 'View' | 'Edit' | 'Owner' = 'View';\n\n public _Loading: boolean = false;\n\n public async UpdateResourceRecordID(ResourceRecordID: string) {\n this.ResourceRecordID = ResourceRecordID;\n // now go through all of our permissions and update the ResourceRecordID\n for (const permission of this.resourcePermissions) {\n permission.ResourceRecordID = ResourceRecordID\n }\n }\n\n public resourcePermissions: MJResourcePermissionEntity[] = [];\n async ngAfterViewInit() {\n if (!this.ResourceTypeID || !this.ResourceRecordID) {\n throw new Error('ResourceTypeID and ResourceRecordID must be set');\n }\n\n this._Loading = true;\n // load up the current permissions for the specified ResourceTypeID and ResourceRecordID\n const engine = this.GetEngine();\n await engine.Config(false, this.ProviderToUse.CurrentUser, this.ProviderToUse);\n // now we can get the permissions for the specified resource\n const allResourcePermissions = engine.GetResourcePermissions(this.ResourceTypeID, this.ResourceRecordID);\n this.resourcePermissions = allResourcePermissions.filter((p) => p.Status === 'Approved'); // only include approved permissions in the UI, we don't show requested, rejected, revoked permissions here, just suppress them.\n \n const p = this.ProviderToUse;\n const rv = RunView.FromMetadataProvider(p)\n const result = await rv.RunView<MJUserEntity>({\n EntityName: \"MJ: Users\",\n ResultType: \"entity_object\",\n OrderBy: \"Name\",\n ExtraFilter: \"IsActive=1\"\n });\n // filter out any users that are in the ExcludedUserEmails list\n this.AllUsers = result.Results.filter((u) => !this.ExcludedUserEmails.includes(u.Email));\n // filter out any roles that are in the ExcludedRoleNames list\n this.AllRoles = p.Roles.filter((r) => !this.ExcludedRoleNames.includes(r.Name));\n\n if (this.AllUsers.length > 0)\n this.SelectedUser = this.AllUsers[0];\n if (this.AllRoles.length > 0)\n this.SelectedRole = this.AllRoles[0];\n\n this._Loading = false;\n }\n\n private _pendingDeletes: MJResourcePermissionEntity[] = [];\n public deletePermission(permission: MJResourcePermissionEntity) {\n this._pendingDeletes.push(permission);\n this.resourcePermissions = this.resourcePermissions.filter((p) => p !== permission);\n }\n\n private _pendingAdds: MJResourcePermissionEntity[] = [];\n public async addPermission() {\n const p = this.ProviderToUse;\n const permission = await p.GetEntityObject<MJResourcePermissionEntity>(\"MJ: Resource Permissions\", p.CurrentUser);\n permission.ResourceTypeID = this.ResourceTypeID;\n permission.ResourceRecordID = this.ResourceRecordID;\n permission.Type = this.SelectedType;\n permission.Status = 'Approved';\n permission.PermissionLevel = this.SelectedPermissionLevel;\n if (this.SelectedType === 'User' && this.SelectedUser) {\n permission.UserID = this.SelectedUser.ID;\n permission.Set(\"User\", this.SelectedUser.Name);// set the virtual field for display purposes\n }\n else if (this.SelectedType === 'Role' && this.SelectedRole) { \n permission.RoleID = this.SelectedRole.ID;\n permission.Set(\"Role\", this.SelectedRole.Name); // set the virtual field for display purposes\n }\n else {\n LogError('Invalid permission type or missing user/role');\n return;\n }\n this.resourcePermissions.push(permission);\n }\n\n public permissionAlreadyExists(): boolean {\n // check to see if the selection that the user currently has in place for the combination of TYPE + either USER or ROLE already exists\n // in our list of permissions\n for (const permission of this.resourcePermissions) {\n if (permission.Type === this.SelectedType) {\n if (this.SelectedType === 'User' && UUIDsEqual(permission.UserID, this.SelectedUser?.ID)) {\n return true;\n }\n else if (this.SelectedType === 'Role' && UUIDsEqual(permission.RoleID, this.SelectedRole?.ID)) {\n return true;\n }\n }\n }\n\n // if we get here, then the permission does not already exist\n return false;\n }\n\n public async SavePermissions(): Promise<boolean> {\n // first delete any permissions that were marked for deletion\n this._Loading = true;\n const p = this.ProviderToUse;\n const tg = await p.CreateTransactionGroup();\n for (const permission of this._pendingDeletes) {\n if (permission.IsSaved) {\n // only delete records previously saved, sometimes a user adds a new permission and deletes it before saving it\n permission.TransactionGroup = tg;\n if (!await permission.Delete()) { // we use await here because the promise will resolve before the actual save occurs --- the internals will not call the network until tg.Submit() below\n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error deleting permission record in the transaction group: ' + permission.LatestResult.CompleteMessage);\n return false;\n } \n } \n }\n\n // next add new permissions by saving them in the transaction group\n for (const permission of this._pendingAdds) {\n if (this._pendingDeletes.includes(permission)) {\n // don't save a permission record that is new, if it was also marked for deletion\n permission.TransactionGroup = tg;\n if (!await permission.Save()) { \n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error saving permission record in the transaction group: ' + permission.LatestResult.CompleteMessage); \n return false;\n }\n }\n }\n\n // now save the existing permissions\n for (const permission of this.resourcePermissions) {\n // make sure not in the delete array\n if (!this._pendingDeletes.includes(permission)) {\n permission.TransactionGroup = tg;\n if (!await permission.Save()) { \n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error saving permission record in the transaction group: ' + permission.LatestResult.CompleteMessage);\n return false;\n }\n }\n }\n\n // now save the changes\n if (await tg.Submit()) {\n this._Loading = false;\n this._pendingDeletes = [];\n this._pendingAdds = [];\n const engine = this.GetEngine();\n await engine.RefreshAllItems(); // refresh the permissions cache\n return true;\n }\n else {\n // we had an error, show the user via SharedService\n this._Loading = false;\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', );\n \n LogError('Error saving permissions in the transaction group');\n return false;\n }\n }\n\n protected GetEngine(): ResourcePermissionEngine {\n return <ResourcePermissionEngine>ResourcePermissionEngine.GetProviderInstance(this.ProviderToUse, ResourcePermissionEngine);\n }\n}\n","<div class=\"container\">\n @if(_Loading) {\n <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n }\n @if(ShowSaveButton) {\n <button mjButton (click)=\"SavePermissions()\">Save</button>\n }\n <div class=\"table-container\">\n @if(AllowAddPermissions) {\n <div class=\"add-permission-section\">\n <span class=\"add-permission-label\">Add Permission</span>\n <mj-dropdown\n [Data]=\"PermissionTypes\"\n [(ngModel)]=\"SelectedType\"\n style=\"width: 100px;\">\n </mj-dropdown>\n @if (SelectedType === 'User') {\n <mj-dropdown\n [Data]=\"AllUsers\"\n [(ngModel)]=\"SelectedUser\"\n TextField=\"Name\"\n ValueField=\"ID\"\n style=\"width: 225px;\">\n </mj-dropdown>\n }\n @else if (SelectedType === 'Role') {\n <mj-dropdown\n [Data]=\"AllRoles\"\n [(ngModel)]=\"SelectedRole\"\n TextField=\"Name\"\n ValueField=\"ID\"\n style=\"width: 150px;\">\n </mj-dropdown>\n }\n @else {\n SelectedType: {{ SelectedType }}\n }\n @if (ShowPermissionLevels) {\n <mj-dropdown\n [Data]=\"PermissionLevels\"\n [(ngModel)]=\"SelectedPermissionLevel\"\n style=\"width: 100px;\">\n </mj-dropdown>\n }\n <button mjButton (click)=\"addPermission()\" [disabled]=\"permissionAlreadyExists()\" [title]=\"permissionAlreadyExists() ? 'This combination of Type/User/Role already exists below' : ''\" >Add</button>\n </div>\n }\n <table class=\"resource-table\">\n <thead>\n <tr>\n <th>Type</th>\n <th>Name</th>\n @if (ShowPermissionLevels) {\n <th>Level</th>\n }\n @if(AllowDeletePermissions) {\n <th>Actions</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (p of resourcePermissions; track p) {\n <tr>\n <td>{{ p.Type }}</td>\n <td>{{ p.Type === 'User' ? p.User : p.Role }}</td>\n @if (ShowPermissionLevels) {\n <td>\n @if (AllowEditPermissions) {\n <mj-dropdown\n [(ngModel)]=\"p.PermissionLevel\"\n [Data]=\"PermissionLevels\"\n style=\"width: 100px;\">\n </mj-dropdown>\n }\n @else {\n {{ p.PermissionLevel }}\n }\n </td>\n }\n @if(AllowDeletePermissions) {\n <td>\n <button mjButton aria-label=\"Delete permission\" title=\"Delete permission\" (click)=\"deletePermission(p)\"><span class=\"fa-solid fa-trash-can\"></span></button>\n </td>\n }\n </tr> \n }\n </tbody>\n </table>\n </div>\n</div>\n"]}
1
+ {"version":3,"file":"resource-permissions.component.js","sourceRoot":"","sources":["../../src/lib/resource-permissions.component.ts","../../src/lib/resource-permissions.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAA4C,MAAM,+BAA+B,CAAC;AACnH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;ICHrE,gCAA0D;;IAA9C,gCAAkB;;;;IAG9B,iCAA6C;IAA5B,gMAAS,wBAAiB,KAAC;IAAC,oBAAI;IAAA,iBAAS;;;;IAYpD,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C,KAAK;;kBAIL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAIL,KAAK;;kBAIL,KAAK;;kBAIL,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAML,KAAK;;kFA1DK,4BAA4B","sourcesContent":["import { AfterViewInit, Component, Input } from '@angular/core';\nimport { LogError, RoleInfo, RunView } from '@memberjunction/core';\nimport { ResourcePermissionEngine, MJResourcePermissionEntity, MJUserEntity } from '@memberjunction/core-entities';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\n\n/**\n * Visual component used to display and manage permissions for a resource. You can wrap this in a dialog or display anywhere else within\n * an Angular application or component.\n */\n@Component({\n standalone: false,\n selector: 'mj-resource-permissions',\n templateUrl: './resource-permissions.component.html',\n styleUrls: ['./resource-permissions.component.css']\n})\nexport class ResourcePermissionsComponent extends BaseAngularComponent implements AfterViewInit {\n /**\n * Required: the ID of the resource type record for the specified resource that the permissions are being set for.\n */\n @Input() ResourceTypeID!: string;\n /**\n * Required: the record ID of the resource that the permissions are being set for.\n */ \n @Input() ResourceRecordID!: string;\n /**\n * If set to true, the component will show a Save button to the user and persist the changes to the \n * database when the user clicks the Save button. By default this is off to allow users of the component\n * to wrap the component as desired, and handle the save themselves.\n */\n @Input() ShowSaveButton: boolean = false;\n /**\n * If set to true, the component will show the permission levels to the user. By default this is on. If you have \n * a Resource Type or run-time use case where levels are not relevant, you can turn this off.\n */\n @Input() ShowPermissionLevels: boolean = true;\n /**\n * By default, this component will not show any error messages to the user. \n * If you want to show error messages to the user, set this to true. The component will always throw exceptions when error occur internally.\n */\n @Input() ShowUserErrorMessages: boolean = false;\n /**\n * Allows you to determine if the user is able to add new permissions for the resource.\n */\n @Input() AllowAddPermissions: boolean = true;\n /**\n * Allows you to determine if the user is able to edit existing permissions for the resource.\n */\n @Input() AllowEditPermissions: boolean = true;\n /**\n * Allows you to determine if the user is able to delete existing permissions for the resource.\n */\n @Input() AllowDeletePermissions: boolean = true;\n\n /**\n * List of possible permission levels that can be set for the resource. An array of strings, defaults to ['View', 'Edit', 'Owner']\n */\n @Input() PermissionLevels = ['View', 'Edit', 'Owner']; // these are the possible permission levels\n\n /**\n * Specifies the types of permissions the UI will allow settings for. An array of strings, defaults to ['User', 'Role']\n */\n @Input() PermissionTypes = ['User', 'Role'];\n\n /**\n * This optional input allows you to exclude certain roles from the list of roles that can be selected for permissions. If existing permissions have been created with roles that are in this list they will still be displayed, \n * but the user will not be able to add new permissions with these roles. This is an array of strings with the NAMES of the roles.\n */\n @Input() ExcludedRoleNames: string[] = [];\n\n /**\n * This optional input allows you to exclude certain users from the list of users that can be selected for permissions. If existing permissions have been created with users that are in this list they will still be displayed, \n * but the user will not be able to add new permissions with these users. This is an array of strings with EMAILS.\n */\n @Input() ExcludedUserEmails: string[] = [];\n\n public AllUsers: MJUserEntity[] = [];\n public AllRoles: RoleInfo[] = [];\n\n public SelectedUser: MJUserEntity | null = null;\n public SelectedRole: RoleInfo | null = null;\n public SelectedType: 'User' | 'Role' = 'Role';\n public SelectedPermissionLevel: 'View' | 'Edit' | 'Owner' = 'View';\n\n public Loading: boolean = false;\n\n /** @deprecated Use {@link Loading}. */\n public get _Loading(): boolean {\n return this.Loading;\n }\n /** @deprecated Use {@link Loading}. */\n public set _Loading(value: boolean) {\n this.Loading = value;\n }\n\n public async UpdateResourceRecordID(ResourceRecordID: string) {\n this.ResourceRecordID = ResourceRecordID;\n // now go through all of our permissions and update the ResourceRecordID\n for (const permission of this.ResourcePermissions) {\n permission.ResourceRecordID = ResourceRecordID\n }\n }\n\n public ResourcePermissions: MJResourcePermissionEntity[] = [];\n\n /** @deprecated Use {@link ResourcePermissions}. */\n public get resourcePermissions(): MJResourcePermissionEntity[] {\n return this.ResourcePermissions;\n }\n /** @deprecated Use {@link ResourcePermissions}. */\n public set resourcePermissions(value: MJResourcePermissionEntity[]) {\n this.ResourcePermissions = value;\n }\n async ngAfterViewInit() {\n if (!this.ResourceTypeID || !this.ResourceRecordID) {\n throw new Error('ResourceTypeID and ResourceRecordID must be set');\n }\n\n this.Loading = true;\n // load up the current permissions for the specified ResourceTypeID and ResourceRecordID\n const engine = this.GetEngine();\n await engine.Config(false, this.ProviderToUse.CurrentUser, this.ProviderToUse);\n // now we can get the permissions for the specified resource\n const allResourcePermissions = engine.GetResourcePermissions(this.ResourceTypeID, this.ResourceRecordID);\n this.ResourcePermissions = allResourcePermissions.filter((p) => p.Status === 'Approved'); // only include approved permissions in the UI, we don't show requested, rejected, revoked permissions here, just suppress them.\n \n const p = this.ProviderToUse;\n const rv = RunView.FromMetadataProvider(p)\n const result = await rv.RunView<MJUserEntity>({\n EntityName: \"MJ: Users\",\n ResultType: \"entity_object\",\n OrderBy: \"Name\",\n ExtraFilter: \"IsActive=1\"\n });\n // filter out any users that are in the ExcludedUserEmails list\n this.AllUsers = result.Results.filter((u) => !this.ExcludedUserEmails.includes(u.Email));\n // filter out any roles that are in the ExcludedRoleNames list\n this.AllRoles = p.Roles.filter((r) => !this.ExcludedRoleNames.includes(r.Name));\n\n if (this.AllUsers.length > 0)\n this.SelectedUser = this.AllUsers[0];\n if (this.AllRoles.length > 0)\n this.SelectedRole = this.AllRoles[0];\n\n this.Loading = false;\n }\n\n private _pendingDeletes: MJResourcePermissionEntity[] = [];\n public DeletePermission(permission: MJResourcePermissionEntity) {\n this._pendingDeletes.push(permission);\n this.ResourcePermissions = this.ResourcePermissions.filter((p) => p !== permission);\n }\n\n /** @deprecated Use {@link DeletePermission}. */\n public deletePermission(permission: MJResourcePermissionEntity) {\n return this.DeletePermission(permission);\n }\n\n private _pendingAdds: MJResourcePermissionEntity[] = [];\n public async AddPermission() {\n const p = this.ProviderToUse;\n const permission = await p.GetEntityObject<MJResourcePermissionEntity>(\"MJ: Resource Permissions\", p.CurrentUser);\n permission.ResourceTypeID = this.ResourceTypeID;\n permission.ResourceRecordID = this.ResourceRecordID;\n permission.Type = this.SelectedType;\n permission.Status = 'Approved';\n permission.PermissionLevel = this.SelectedPermissionLevel;\n if (this.SelectedType === 'User' && this.SelectedUser) {\n permission.UserID = this.SelectedUser.ID;\n permission.Set(\"User\", this.SelectedUser.Name);// set the virtual field for display purposes\n }\n else if (this.SelectedType === 'Role' && this.SelectedRole) { \n permission.RoleID = this.SelectedRole.ID;\n permission.Set(\"Role\", this.SelectedRole.Name); // set the virtual field for display purposes\n }\n else {\n LogError('Invalid permission type or missing user/role');\n return;\n }\n this.ResourcePermissions.push(permission);\n }\n\n /** @deprecated Use {@link AddPermission}. */\n public async addPermission() {\n return this.AddPermission();\n }\n\n public PermissionAlreadyExists(): boolean {\n // check to see if the selection that the user currently has in place for the combination of TYPE + either USER or ROLE already exists\n // in our list of permissions\n for (const permission of this.ResourcePermissions) {\n if (permission.Type === this.SelectedType) {\n if (this.SelectedType === 'User' && UUIDsEqual(permission.UserID, this.SelectedUser?.ID)) {\n return true;\n }\n else if (this.SelectedType === 'Role' && UUIDsEqual(permission.RoleID, this.SelectedRole?.ID)) {\n return true;\n }\n }\n }\n\n // if we get here, then the permission does not already exist\n return false;\n }\n\n /** @deprecated Use {@link PermissionAlreadyExists}. */\n public permissionAlreadyExists(): boolean {\n return this.PermissionAlreadyExists();\n }\n\n public async SavePermissions(): Promise<boolean> {\n // first delete any permissions that were marked for deletion\n this.Loading = true;\n const p = this.ProviderToUse;\n const tg = await p.CreateTransactionGroup();\n for (const permission of this._pendingDeletes) {\n if (permission.IsSaved) {\n // only delete records previously saved, sometimes a user adds a new permission and deletes it before saving it\n permission.TransactionGroup = tg;\n if (!await permission.Delete()) { // we use await here because the promise will resolve before the actual save occurs --- the internals will not call the network until tg.Submit() below\n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error deleting permission record in the transaction group: ' + permission.LatestResult.CompleteMessage);\n return false;\n } \n } \n }\n\n // next add new permissions by saving them in the transaction group\n for (const permission of this._pendingAdds) {\n if (this._pendingDeletes.includes(permission)) {\n // don't save a permission record that is new, if it was also marked for deletion\n permission.TransactionGroup = tg;\n if (!await permission.Save()) { \n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error saving permission record in the transaction group: ' + permission.LatestResult.CompleteMessage); \n return false;\n }\n }\n }\n\n // now save the existing permissions\n for (const permission of this.ResourcePermissions) {\n // make sure not in the delete array\n if (!this._pendingDeletes.includes(permission)) {\n permission.TransactionGroup = tg;\n if (!await permission.Save()) { \n // validation errors come back here\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', 2500);\n\n LogError('Error saving permission record in the transaction group: ' + permission.LatestResult.CompleteMessage);\n return false;\n }\n }\n }\n\n // now save the changes\n if (await tg.Submit()) {\n this.Loading = false;\n this._pendingDeletes = [];\n this._pendingAdds = [];\n const engine = this.GetEngine();\n await engine.RefreshAllItems(); // refresh the permissions cache\n return true;\n }\n else {\n // we had an error, show the user via SharedService\n this.Loading = false;\n if (this.ShowUserErrorMessages)\n MJNotificationService.Instance.CreateSimpleNotification('Error saving permissions', 'error', );\n \n LogError('Error saving permissions in the transaction group');\n return false;\n }\n }\n\n protected GetEngine(): ResourcePermissionEngine {\n return <ResourcePermissionEngine>ResourcePermissionEngine.GetProviderInstance(this.ProviderToUse, ResourcePermissionEngine);\n }\n}\n","<div class=\"container\">\n @if(_Loading) {\n <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n }\n @if(ShowSaveButton) {\n <button mjButton (click)=\"SavePermissions()\">Save</button>\n }\n <div class=\"table-container\">\n @if(AllowAddPermissions) {\n <div class=\"add-permission-section\">\n <span class=\"add-permission-label\">Add Permission</span>\n <mj-dropdown\n [Data]=\"PermissionTypes\"\n [(ngModel)]=\"SelectedType\"\n style=\"width: 100px;\">\n </mj-dropdown>\n @if (SelectedType === 'User') {\n <mj-dropdown\n [Data]=\"AllUsers\"\n [(ngModel)]=\"SelectedUser\"\n TextField=\"Name\"\n ValueField=\"ID\"\n style=\"width: 225px;\">\n </mj-dropdown>\n }\n @else if (SelectedType === 'Role') {\n <mj-dropdown\n [Data]=\"AllRoles\"\n [(ngModel)]=\"SelectedRole\"\n TextField=\"Name\"\n ValueField=\"ID\"\n style=\"width: 150px;\">\n </mj-dropdown>\n }\n @else {\n SelectedType: {{ SelectedType }}\n }\n @if (ShowPermissionLevels) {\n <mj-dropdown\n [Data]=\"PermissionLevels\"\n [(ngModel)]=\"SelectedPermissionLevel\"\n style=\"width: 100px;\">\n </mj-dropdown>\n }\n <button mjButton (click)=\"addPermission()\" [disabled]=\"permissionAlreadyExists()\" [title]=\"permissionAlreadyExists() ? 'This combination of Type/User/Role already exists below' : ''\" >Add</button>\n </div>\n }\n <table class=\"resource-table\">\n <thead>\n <tr>\n <th>Type</th>\n <th>Name</th>\n @if (ShowPermissionLevels) {\n <th>Level</th>\n }\n @if(AllowDeletePermissions) {\n <th>Actions</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (p of resourcePermissions; track p) {\n <tr>\n <td>{{ p.Type }}</td>\n <td>{{ p.Type === 'User' ? p.User : p.Role }}</td>\n @if (ShowPermissionLevels) {\n <td>\n @if (AllowEditPermissions) {\n <mj-dropdown\n [(ngModel)]=\"p.PermissionLevel\"\n [Data]=\"PermissionLevels\"\n style=\"width: 100px;\">\n </mj-dropdown>\n }\n @else {\n {{ p.PermissionLevel }}\n }\n </td>\n }\n @if(AllowDeletePermissions) {\n <td>\n <button mjButton aria-label=\"Delete permission\" title=\"Delete permission\" (click)=\"deletePermission(p)\"><span class=\"fa-solid fa-trash-can\"></span></button>\n </td>\n }\n </tr> \n }\n </tbody>\n </table>\n </div>\n</div>\n"]}
@@ -32,6 +32,26 @@ export interface ResourceSharePermissionModel {
32
32
  */
33
33
  _InitialLevel?: ResourceShareLevel;
34
34
  }
35
+ /**
36
+ * One person's access across the resources a dialog is sharing. The dialog works
37
+ * in grants, not rows: a grant carries the loaded permission row per resource, so
38
+ * every action (add, level change, removal) applies to the whole set at once.
39
+ */
40
+ export interface ResourceShareGrant {
41
+ User: MJUserEntity;
42
+ UserID: string;
43
+ /** Loaded permission rows, keyed by `ResourceShareContext.ResourceID`. */
44
+ Rows: Map<string, ResourceSharePermissionModel>;
45
+ /** Level held on every resource at load time; null when they differ. */
46
+ InitialLevel: ResourceShareLevel | null;
47
+ /** Level to apply on save. */
48
+ Level: ResourceShareLevel;
49
+ /** True once the user picks a level, which also fills in resources with no grant. */
50
+ LevelTouched: boolean;
51
+ /** True when this person held no access on any resource at load time. */
52
+ IsNew: boolean;
53
+ MarkedForRemoval: boolean;
54
+ }
35
55
  /**
36
56
  * Per-resource context passed to every adapter call. Kept small and serializable
37
57
  * so the generic dialog can stay resource-type-agnostic.
@@ -1 +1 @@
1
- {"version":3,"file":"resource-share-adapter.d.ts","sourceRoot":"","sources":["../../src/lib/resource-share-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,EAA8B,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IACzC,iEAAiE;IACjE,gBAAgB,EAAE,UAAU,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;IACnB,mDAAmD;IACnD,KAAK,EAAE,kBAAkB,CAAC;IAC1B,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAC;IACf,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAA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AA4B,CAAC,CAAC;IAEtG;;;;;OAKG;IACH,iBAAiB,CAAC,GAAG,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAE3D;;;OAGG;IACH,SAAS,CAAC,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"resource-share-adapter.js","sourceRoot":"","sources":["../../src/lib/resource-share-adapter.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import { BaseEntity } from '@memberjunction/core';\nimport { MJUserEntity } from '@memberjunction/core-entities';\n\n/** Three permission tiers used across every share dialog: view-only, modify, full control. */\nexport type ResourceShareLevel = 'View' | 'Edit' | 'Owner';\n\n/**\n * Ordered list used by the dialog to render the level selector. Exposed so\n * adapters or tests can reference it without re-declaring the enum.\n */\nexport const RESOURCE_SHARE_LEVELS: ResourceShareLevel[] = ['View', 'Edit', 'Owner'];\n\n/**\n * A single share row displayed in {@link GenericShareDialogComponent}. The\n * dialog treats every resource type uniformly with a three-tier permission\n * model — adapters translate the `Level` field to whatever shape their\n * backing entity actually stores (e.g., `MJResourcePermissionEntity.PermissionLevel`\n * is a direct match; `MJDashboardPermissionEntity` maps to a combination of\n * `Can*` booleans).\n */\nexport interface ResourceSharePermissionModel {\n /** BaseEntity instance to persist on save / delete on remove. */\n PermissionEntity: BaseEntity;\n UserID: string;\n User: MJUserEntity;\n /** Current permission tier shown in the dialog. */\n Level: ResourceShareLevel;\n /** `true` if this row was added in the current dialog session (no DB row yet). */\n IsNew: boolean;\n /** `true` if the user clicked the trash icon; will be deleted on save. */\n MarkedForRemoval: boolean;\n /**\n * Snapshot of `Level` captured when the row was first created/loaded.\n * Populated by the dialog; used by `HasChanges` to detect user edits.\n */\n _InitialLevel?: ResourceShareLevel;\n}\n\n/**\n * Per-resource context passed to every adapter call. Kept small and serializable\n * so the generic dialog can stay resource-type-agnostic.\n */\nexport interface ResourceShareContext {\n /** Primary key of the resource being shared. */\n ResourceID: string;\n /** Display name used in the dialog title (`Share \"{{ResourceName}}\"`). */\n ResourceName: string;\n /** UserID of the resource owner (excluded from the \"add people\" list). */\n OwnerUserID?: string | null;\n /** Owner's display name, shown in the static \"Owner\" row. */\n OwnerDisplayName?: string | null;\n /** UserID of the person currently using the dialog (captured on save as grantor). */\n CurrentUserID?: string | null;\n}\n\n/**\n * Contract implemented by per-resource adapters that plug into\n * {@link GenericShareDialogComponent}. The dialog owns the UX (user search,\n * level selector, mark-for-removal); the adapter owns persistence.\n */\nexport interface ResourceShareAdapter {\n /** Load existing share rows for the resource. Owner is NOT included here. */\n LoadShares(context: ResourceShareContext): Promise<ResourceSharePermissionModel[]>;\n\n /**\n * Create an un-saved {@link ResourceSharePermissionModel} for `user`, defaulting\n * the level to `View`. The returned row's `PermissionEntity` must be a valid\n * BaseEntity pre-populated with everything except the level.\n */\n CreateShare(context: ResourceShareContext, user: MJUserEntity): Promise<ResourceSharePermissionModel>;\n\n /**\n * Apply the current `Level` back onto the adapter's underlying entity shape\n * before the dialog calls `.Save()`. For `MJResourcePermission`-backed\n * resources this is a direct `PermissionLevel =` assignment; for\n * `MJDashboardPermission` it translates to the four `Can*` booleans.\n */\n SyncLevelToEntity(row: ResourceSharePermissionModel): void;\n\n /**\n * Called after all saves/deletes succeed — a hook for cache refresh\n * (e.g., `DashboardEngine.Config(true)`). Optional.\n */\n AfterSave?(context: ResourceShareContext): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"resource-share-adapter.js","sourceRoot":"","sources":["../../src/lib/resource-share-adapter.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import { BaseEntity } from '@memberjunction/core';\nimport { MJUserEntity } from '@memberjunction/core-entities';\n\n/** Three permission tiers used across every share dialog: view-only, modify, full control. */\nexport type ResourceShareLevel = 'View' | 'Edit' | 'Owner';\n\n/**\n * Ordered list used by the dialog to render the level selector. Exposed so\n * adapters or tests can reference it without re-declaring the enum.\n */\nexport const RESOURCE_SHARE_LEVELS: ResourceShareLevel[] = ['View', 'Edit', 'Owner'];\n\n/**\n * A single share row displayed in {@link GenericShareDialogComponent}. The\n * dialog treats every resource type uniformly with a three-tier permission\n * model — adapters translate the `Level` field to whatever shape their\n * backing entity actually stores (e.g., `MJResourcePermissionEntity.PermissionLevel`\n * is a direct match; `MJDashboardPermissionEntity` maps to a combination of\n * `Can*` booleans).\n */\nexport interface ResourceSharePermissionModel {\n /** BaseEntity instance to persist on save / delete on remove. */\n PermissionEntity: BaseEntity;\n UserID: string;\n User: MJUserEntity;\n /** Current permission tier shown in the dialog. */\n Level: ResourceShareLevel;\n /** `true` if this row was added in the current dialog session (no DB row yet). */\n IsNew: boolean;\n /** `true` if the user clicked the trash icon; will be deleted on save. */\n MarkedForRemoval: boolean;\n /**\n * Snapshot of `Level` captured when the row was first created/loaded.\n * Populated by the dialog; used by `HasChanges` to detect user edits.\n */\n _InitialLevel?: ResourceShareLevel;\n}\n\n/**\n * One person's access across the resources a dialog is sharing. The dialog works\n * in grants, not rows: a grant carries the loaded permission row per resource, so\n * every action (add, level change, removal) applies to the whole set at once.\n */\nexport interface ResourceShareGrant {\n User: MJUserEntity;\n UserID: string;\n /** Loaded permission rows, keyed by `ResourceShareContext.ResourceID`. */\n Rows: Map<string, ResourceSharePermissionModel>;\n /** Level held on every resource at load time; null when they differ. */\n InitialLevel: ResourceShareLevel | null;\n /** Level to apply on save. */\n Level: ResourceShareLevel;\n /** True once the user picks a level, which also fills in resources with no grant. */\n LevelTouched: boolean;\n /** True when this person held no access on any resource at load time. */\n IsNew: boolean;\n MarkedForRemoval: boolean;\n}\n\n/**\n * Per-resource context passed to every adapter call. Kept small and serializable\n * so the generic dialog can stay resource-type-agnostic.\n */\nexport interface ResourceShareContext {\n /** Primary key of the resource being shared. */\n ResourceID: string;\n /** Display name used in the dialog title (`Share \"{{ResourceName}}\"`). */\n ResourceName: string;\n /** UserID of the resource owner (excluded from the \"add people\" list). */\n OwnerUserID?: string | null;\n /** Owner's display name, shown in the static \"Owner\" row. */\n OwnerDisplayName?: string | null;\n /** UserID of the person currently using the dialog (captured on save as grantor). */\n CurrentUserID?: string | null;\n}\n\n/**\n * Contract implemented by per-resource adapters that plug into\n * {@link GenericShareDialogComponent}. The dialog owns the UX (user search,\n * level selector, mark-for-removal); the adapter owns persistence.\n */\nexport interface ResourceShareAdapter {\n /** Load existing share rows for the resource. Owner is NOT included here. */\n LoadShares(context: ResourceShareContext): Promise<ResourceSharePermissionModel[]>;\n\n /**\n * Create an un-saved {@link ResourceSharePermissionModel} for `user`, defaulting\n * the level to `View`. The returned row's `PermissionEntity` must be a valid\n * BaseEntity pre-populated with everything except the level.\n */\n CreateShare(context: ResourceShareContext, user: MJUserEntity): Promise<ResourceSharePermissionModel>;\n\n /**\n * Apply the current `Level` back onto the adapter's underlying entity shape\n * before the dialog calls `.Save()`. For `MJResourcePermission`-backed\n * resources this is a direct `PermissionLevel =` assignment; for\n * `MJDashboardPermission` it translates to the four `Can*` booleans.\n */\n SyncLevelToEntity(row: ResourceSharePermissionModel): void;\n\n /**\n * Called after all saves/deletes succeed — a hook for cache refresh\n * (e.g., `DashboardEngine.Config(true)`). Optional.\n */\n AfterSave?(context: ResourceShareContext): Promise<void>;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter, OnChanges, SimpleChanges, ChangeDetectorRef } from '@angular/core';
2
2
  import { BaseAngularComponent } from '@memberjunction/ng-base-types';
3
3
  import { MJUserEntity } from '@memberjunction/core-entities';
4
- import { ResourceShareAdapter, ResourceShareContext, ResourceShareLevel, ResourceSharePermissionModel } from './resource-share-adapter';
4
+ import { ResourceShareAdapter, ResourceShareContext, ResourceShareGrant, ResourceShareLevel } from './resource-share-adapter';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Result emitted when {@link GenericShareDialogComponent} closes.
@@ -18,37 +18,90 @@ export interface ResourceShareDialogResult {
18
18
  export declare class GenericShareDialogComponent extends BaseAngularComponent implements OnChanges {
19
19
  private cdr;
20
20
  Visible: boolean;
21
+ /** The single resource being shared. Ignored when `Contexts` is supplied. */
21
22
  Context: ResourceShareContext | null;
23
+ /** Several resources to share at once; every action applies to all of them. */
24
+ Contexts: ResourceShareContext[] | null;
22
25
  Adapter: ResourceShareAdapter | null;
26
+ /** Singular noun for the title when sharing several ("3 conversations"). */
27
+ ResourceLabel: string;
28
+ /** Optional line shown above the dialog body — e.g. what the caller left out. */
29
+ Notice: string | null;
23
30
  Result: EventEmitter<ResourceShareDialogResult>;
24
31
  readonly Levels: ResourceShareLevel[];
25
- UserShares: ResourceSharePermissionModel[];
32
+ Grants: ResourceShareGrant[];
26
33
  AvailableUsers: MJUserEntity[];
27
34
  private allUsers;
28
35
  IsLoading: boolean;
29
36
  Error: string | null;
30
37
  UserSearchFilter: string;
38
+ /** Every resource this dialog is operating on. */
39
+ get ActiveContexts(): ResourceShareContext[];
40
+ /** The resource whose owner row is shown — only meaningful for a single resource. */
41
+ get PrimaryContext(): ResourceShareContext | null;
42
+ get Title(): string;
31
43
  /** Message for the no-results empty-state, echoing the current search term. */
32
44
  get NoUsersFoundMessage(): string;
33
45
  constructor(cdr: ChangeDetectorRef);
34
46
  ngOnChanges(changes: SimpleChanges): void;
35
47
  private resetDialog;
36
- private loadData;
48
+ /** Loads the people list and every resource's existing shares, merged per person. */
49
+ Reload(): Promise<void>;
50
+ private loadUsers;
51
+ /** One grant per person, carrying their row on each resource that has one. */
52
+ private mergeIntoGrants;
53
+ /** Everyone who owns none of the resources and doesn't already hold a (live) grant. */
37
54
  private updateAvailableUsers;
55
+ /** The first ten matches for the search box, or the first ten people. */
38
56
  get FilteredAvailableUsers(): MJUserEntity[];
39
57
  get HasChanges(): boolean;
40
- get ActiveShares(): ResourceSharePermissionModel[];
41
- get RemovedShares(): ResourceSharePermissionModel[];
42
- /** Highlight rows whose level has been changed from their loaded state. */
43
- isModified(share: ResourceSharePermissionModel): boolean;
58
+ get ActiveShares(): ResourceShareGrant[];
59
+ get RemovedShares(): ResourceShareGrant[];
60
+ /** Highlight grants whose level has been changed from their loaded state. */
61
+ IsModified(grant: ResourceShareGrant): boolean;
62
+ /** A level button lights up only when the grant has one level to show. */
63
+ IsLevelActive(grant: ResourceShareGrant, level: ResourceShareLevel): boolean;
64
+ /**
65
+ * Why a grant does not simply read as "everyone, one level": levels that
66
+ * differ across resources, or access held on only some of them.
67
+ */
68
+ ScopeLabel(grant: ResourceShareGrant): string;
69
+ /** Adds a person, to every resource the dialog is sharing. */
70
+ AddUserShare(user: MJUserEntity): Promise<void>;
71
+ RemoveUserShare(grant: ResourceShareGrant): void;
72
+ UndoRemove(grant: ResourceShareGrant): void;
73
+ /** Sets one level for the person across every resource, filling in any gaps. */
74
+ SetLevel(grant: ResourceShareGrant, level: ResourceShareLevel): void;
75
+ OnSave(): Promise<void>;
76
+ /**
77
+ * Withdraws a person's access from every resource that granted it. Each row
78
+ * leaves the grant once deleted, so a retry after a failure deletes only the
79
+ * rows still left.
80
+ */
81
+ private withdrawGrant;
82
+ /**
83
+ * Writes the grant's level to every resource, creating a permission row for
84
+ * the ones this person did not already have access to. A row stays `IsNew`
85
+ * until it saves, so a retry after a failure saves the rows still unsaved.
86
+ */
87
+ private applyGrant;
88
+ onCancel(): void;
89
+ GetUserInitials(user: MJUserEntity): string;
90
+ /** @deprecated Use {@link IsModified}. */
91
+ isModified(grant: ResourceShareGrant): boolean;
92
+ /** @deprecated Use {@link AddUserShare}. */
44
93
  addUserShare(user: MJUserEntity): Promise<void>;
45
- removeUserShare(share: ResourceSharePermissionModel): void;
46
- undoRemove(share: ResourceSharePermissionModel): void;
47
- setLevel(share: ResourceSharePermissionModel, level: ResourceShareLevel): void;
94
+ /** @deprecated Use {@link RemoveUserShare}. */
95
+ removeUserShare(grant: ResourceShareGrant): void;
96
+ /** @deprecated Use {@link UndoRemove}. */
97
+ undoRemove(grant: ResourceShareGrant): void;
98
+ /** @deprecated Use {@link SetLevel}. */
99
+ setLevel(grant: ResourceShareGrant, level: ResourceShareLevel): void;
100
+ /** @deprecated Use {@link OnSave}. */
48
101
  onSave(): Promise<void>;
49
- onCancel(): void;
102
+ /** @deprecated Use {@link GetUserInitials}. */
50
103
  getUserInitials(user: MJUserEntity): string;
51
104
  static ɵfac: i0.ɵɵFactoryDeclaration<GenericShareDialogComponent, never>;
52
- static ɵcmp: i0.ɵɵComponentDeclaration<GenericShareDialogComponent, "mj-resource-share-dialog", never, { "Visible": { "alias": "Visible"; "required": false; }; "Context": { "alias": "Context"; "required": false; }; "Adapter": { "alias": "Adapter"; "required": false; }; }, { "Result": "Result"; }, never, never, false, never>;
105
+ static ɵcmp: i0.ɵɵComponentDeclaration<GenericShareDialogComponent, "mj-resource-share-dialog", never, { "Visible": { "alias": "Visible"; "required": false; }; "Context": { "alias": "Context"; "required": false; }; "Contexts": { "alias": "Contexts"; "required": false; }; "Adapter": { "alias": "Adapter"; "required": false; }; "ResourceLabel": { "alias": "ResourceLabel"; "required": false; }; "Notice": { "alias": "Notice"; "required": false; }; }, { "Result": "Result"; }, never, never, false, never>;
53
106
  }
54
107
  //# sourceMappingURL=resource-share-dialog.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-share-dialog.component.d.ts","sourceRoot":"","sources":["../../src/lib/resource-share-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAqB,MAAM,eAAe,CAAC;AACvI,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAEH,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,E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