[DevExpress Support Team: CLONED FROM T418166: How to use the Allow/Deny permissions policy in the existing project]
Hi,
I am trying to convert my users to new systems. I reworked my code, but following code returns no objects:
C#foreach (SecuritySystemUser securitySystemUser in ObjectSpace.GetObjects<SecuritySystemUser>()) {
CopyUser(securitySystemUser);
}
foreach (SecuritySystemRole securitySystemRole in ObjectSpace.GetObjects<SecuritySystemRole>()) {
CopyRole(securitySystemRole, null);
}
I checked the database, old tables are still populated. Any ideas why this might be happening?
Should this code be run before or after the change to UserType and RoleType?
Regards,
Mario
Hi,
Yes, when I switch back to SecuritySystemUser then it is working, because when I switch to PermissionPolicyUser, it seems SecuritySystemUser and SSRole are not among ExportedTypes and I can not find a way to manually add them.
I need update to go in one stage, which means application needs to be switched to PermissionPolicyUser and above code has to work so I can transfer users and permissions.
How do I force SecuritySystemUser and Role into ExportedTypes?
Thanks,
Mario
Hi,
I added this code in Module.cs:
AdditionalExportedTypes.AddRange( new Type[] { typeof(SecuritySystemUser), typeof(SecuritySystemRole) });
Which seemed to do the trick.
Regards,
Mario
Hi,
DevExpress v16.1.7
I am trying the same, but is not working for me. In where class part from module.cs have you added that??
BR,
Juan
@Mario
Thank you for the clarification, Mario.
We are happy to hear that you have found a solution.
See also:
Ways to Add a Business Class
To load a class from the XAF Business Class Library to the Application Model, use a module's Module Designer. In the Exported Types section, select the required class represented by a child node of the Referenced Assemblies | DevExpress.Persistent.BaseImpl.v16.1.dll node. Press the SPACEBAR, or right-click and select the Use type in application context menu item. The node will be marked in bold.
@Juan
Hello Juan,
Do I correctly understand that you have found the correct approach to avoid this issue and now are experiencing the new one in the Exception using the T418166 thread?
@Alexey - yes I know about adding classes through designer, but as I noted - SecuritySystemUser and Role was nowhere to be found. That is why I needed to add this code.
@Juan - I added this code in constructor of Module.cs (agnostic module).
@alexey
Hi, now I got the exception before to copy all roles and users , then I can´t know if I have avoid this issue or not.
@Mario
Thanks, now I can´t check it but I will keep you informed, @BothsOfYou
(T446533: Exception using the T418166)
Hello @Mario,
maybe can you help me? can you share with me your scripts " to revamp entire database and remove/move all references" ?
inma.viana@diagonal-soluciones.com
Thanks in advance
Hi Juan,
I decided to write an article about migration:How to migrate DevExpress XAF SecuritySystemUser to PermissionPolicyUser
Hopefully it gets approved soon.
Regards,
Mario
Thanks Mario!! it is great!!!
You are welcome, Juan.
I added some more info from this thread related to registering previous types to make article more complete.