Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
988 B
2
Indexable
Never
public RolePermissionCategoriesModel Initialize(IResourceManager resourceManager)
{
    _allRoles = OFXApp.SecurityContext.SecurityRepositories
        .RunCommand(new GetAllRolesWithPermissionsQuery()).ToList();

    _allPermissions = OFXApp.SecurityContext.SecurityRepositories.RunCommand(new GetAllPermissionsQuery())
        .ToList();

    foreach (var permission in _allPermissions)
    {
        var permissionKey = Regex.Replace(permission.Id, @"[^0-9a-zA-Z]+", "");
        var permissionValue = resourceManager.GetString(permissionKey);
        if (permissionValue != null)
        {
            permission.CultureSensitiveName = permissionValue;
        }
        else
        {
            Log.Warn($"Unable to find localized permission name for {permission.Id}. Using invariant name: {permission.InvariantName}");
            permission.CultureSensitiveName = permission.InvariantName;
        }
    }

    CreateBindingProjects();
    return this;
}
Leave a Comment